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