Created
March 27, 2019 22:40
-
-
Save wuestkamp/15234bc809a98665960ddcaaa457a1a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: sf-deployment | |
labels: | |
id: sf-deployment | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
id: sf | |
template: | |
metadata: | |
labels: | |
id: sf | |
spec: | |
restartPolicy: Always | |
volumes: | |
# we create one shared volume for the symfony assets so nginx and php can access those | |
- name: sf-public | |
emptyDir: {} | |
initContainers: | |
# this container is of same image as our php container, its executed to initialise our pod. | |
# it will mount the shared volume sf-public and copy the (already compiled) symfony assets into it | |
- name: init | |
image: localhost:5000/wuestkamp_php | |
imagePullPolicy: Always | |
volumeMounts: | |
- mountPath: /tmp/sf-public | |
name: sf-public | |
command: ['sh', '-c', 'cp -r /var/www/symfony/public/* /tmp/sf-public/; true;'] | |
containers: | |
# the nginx container, it mounts the shared volume to provide assets directly via http response | |
- image: localhost:5000/wuestkamp_nginx | |
imagePullPolicy: Always | |
name: nginx | |
ports: | |
- containerPort: 80 | |
volumeMounts: | |
- mountPath: /var/www/symfony/public | |
name: sf-public | |
# the php container | |
- image: localhost:5000/wuestkamp_php | |
imagePullPolicy: Always | |
name: php | |
volumeMounts: | |
- mountPath: /var/www/symfony/public | |
name: sf-public | |
env: | |
- name: APP_ENV | |
value: dev | |
- name: PHP_POD_NAME | |
valueFrom: | |
fieldRef: | |
fieldPath: metadata.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment