github.com/jchauncey/draft@v0.3.0/pkg/draft/defaultpacks/node.go (about) 1 package defaultpacks 2 3 import ( 4 "path/filepath" 5 6 "github.com/Azure/draft/pkg/draft/pack" 7 ) 8 9 const nodeValues = `# Default values for node. 10 # This is a YAML-formatted file. 11 # Declare variables to be passed into your templates. 12 replicaCount: 2 13 image: 14 registry: docker.io 15 org: library 16 name: node 17 tag: onbuild 18 pullPolicy: IfNotPresent 19 service: 20 name: node 21 type: ClusterIP 22 externalPort: 8080 23 internalPort: 8080 24 resources: 25 limits: 26 cpu: 100m 27 memory: 128Mi 28 requests: 29 cpu: 100m 30 memory: 128Mi 31 ` 32 33 const nodeDetect = `#!/usr/bin/env bash 34 35 BUILD_DIR=$1 36 37 # Exit early if app is clearly not Node.js. 38 if [ ! -f $BUILD_DIR/package.json ]; then 39 exit 1 40 fi 41 42 echo Node.js 43 ` 44 45 const nodeDockerfile = `FROM node:onbuild 46 EXPOSE 8080 47 RUN npm install 48 CMD ["npm", "start"] 49 ` 50 51 // NodeFiles returns all of the files needed for the python default pack 52 // Paths are relative to the pack root 53 func NodeFiles() []*pack.File { 54 return []*pack.File{ 55 { 56 // values.yaml 57 Path: filepath.Join(pack.ChartDir, pack.ValuesfileName), 58 Content: []byte(nodeValues), 59 Perm: 0644, 60 }, 61 { 62 // .helmignore 63 Path: filepath.Join(pack.ChartDir, pack.IgnorefileName), 64 Content: []byte(commonIgnore), 65 Perm: 0644, 66 }, 67 { 68 // deployment.yaml 69 Path: filepath.Join(pack.ChartDir, pack.TemplatesDir, pack.DeploymentName), 70 Content: []byte(commonDeployment), 71 Perm: 0644, 72 }, 73 { 74 // service.yaml 75 Path: filepath.Join(pack.ChartDir, pack.TemplatesDir, pack.ServiceName), 76 Content: []byte(commonService), 77 Perm: 0644, 78 }, 79 { 80 // ingress.yaml 81 Path: filepath.Join(pack.ChartDir, pack.TemplatesDir, pack.IngressName), 82 Content: []byte(commonIngress), 83 Perm: 0644, 84 }, 85 { 86 // NOTES.txt 87 Path: filepath.Join(pack.ChartDir, pack.TemplatesDir, pack.NotesName), 88 Content: []byte(commonNotes), 89 Perm: 0644, 90 }, 91 { 92 // _helpers.tpl 93 Path: filepath.Join(pack.ChartDir, pack.TemplatesDir, pack.HelpersName), 94 Content: []byte(commonHelpers), 95 Perm: 0644, 96 }, 97 { 98 // detect 99 Path: filepath.Join(pack.DetectName), 100 Content: []byte(nodeDetect), 101 Perm: 0755, 102 }, 103 { 104 // NOTICE 105 Path: filepath.Join(pack.HerokuLicenseName), 106 Content: []byte(commonHerokuLicense), 107 Perm: 0644, 108 }, 109 { 110 // Dockerfile 111 Path: filepath.Join(pack.DockerfileName), 112 Content: []byte(nodeDockerfile), 113 Perm: 0644, 114 }, 115 { 116 // .dockerignore 117 Path: filepath.Join(pack.DockerignoreName), 118 Content: []byte(commonDockerignore), 119 Perm: 0644, 120 }, 121 } 122 }