github.com/jchauncey/draft@v0.3.0/pkg/draft/defaultpacks/ruby.go (about) 1 package defaultpacks 2 3 import ( 4 "path/filepath" 5 6 "github.com/Azure/draft/pkg/draft/pack" 7 ) 8 9 const rubyValues = `# Default values for Ruby. 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: ruby 17 tag: onbuild 18 pullPolicy: IfNotPresent 19 service: 20 name: ruby 21 type: ClusterIP 22 externalPort: 80 23 internalPort: 4567 24 resources: 25 limits: 26 cpu: 100m 27 memory: 128Mi 28 requests: 29 cpu: 100m 30 memory: 128Mi 31 ` 32 33 const rubyDetect = `#!/usr/bin/env bash 34 if [ -f "$1/Gemfile" ]; then 35 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 36 echo "ruby $(cat $SCRIPT_DIR/../VERSION)" 37 exit 0 38 else 39 echo "no" 40 exit 1 41 fi 42 ` 43 44 const rubyDockerfile = `FROM ruby:onbuild 45 EXPOSE 8080 46 ENTRYPOINT ruby 47 CMD app.rb 48 ` 49 50 // RubyFiles returns all of the files needed for the Ruby default pack 51 // Paths are relative to the pack root 52 func RubyFiles() []*pack.File { 53 return []*pack.File{ 54 { 55 // values.yaml 56 Path: filepath.Join(pack.ChartDir, pack.ValuesfileName), 57 Content: []byte(rubyValues), 58 Perm: 0644, 59 }, 60 { 61 // .helmignore 62 Path: filepath.Join(pack.ChartDir, pack.IgnorefileName), 63 Content: []byte(commonIgnore), 64 Perm: 0644, 65 }, 66 { 67 // deployment.yaml 68 Path: filepath.Join(pack.ChartDir, pack.TemplatesDir, pack.DeploymentName), 69 Content: []byte(commonDeployment), 70 Perm: 0644, 71 }, 72 { 73 // service.yaml 74 Path: filepath.Join(pack.ChartDir, pack.TemplatesDir, pack.ServiceName), 75 Content: []byte(commonService), 76 Perm: 0644, 77 }, 78 { 79 // ingress.yaml 80 Path: filepath.Join(pack.ChartDir, pack.TemplatesDir, pack.IngressName), 81 Content: []byte(commonIngress), 82 Perm: 0644, 83 }, 84 { 85 // NOTES.txt 86 Path: filepath.Join(pack.ChartDir, pack.TemplatesDir, pack.NotesName), 87 Content: []byte(commonNotes), 88 Perm: 0644, 89 }, 90 { 91 // _helpers.tpl 92 Path: filepath.Join(pack.ChartDir, pack.TemplatesDir, pack.HelpersName), 93 Content: []byte(commonHelpers), 94 Perm: 0644, 95 }, 96 { 97 // detect 98 Path: filepath.Join(pack.DetectName), 99 Content: []byte(rubyDetect), 100 Perm: 0755, 101 }, 102 { 103 // NOTICE 104 Path: filepath.Join(pack.HerokuLicenseName), 105 Content: []byte(commonHerokuLicense), 106 Perm: 0644, 107 }, 108 { 109 // Dockerfile 110 Path: filepath.Join(pack.DockerfileName), 111 Content: []byte(rubyDockerfile), 112 Perm: 0644, 113 }, 114 { 115 // .dockerignore 116 Path: filepath.Join(pack.DockerignoreName), 117 Content: []byte(commonDockerignore), 118 Perm: 0644, 119 }, 120 } 121 }