Skip to content

Instantly share code, notes, and snippets.

@wuestkamp
Last active March 27, 2019 21:29
Show Gist options
  • Save wuestkamp/57a82a2fe8189526abd2ad09ce82559d to your computer and use it in GitHub Desktop.
Save wuestkamp/57a82a2fe8189526abd2ad09ce82559d to your computer and use it in GitHub Desktop.
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: {}
- name: hostvolume
hostPath:
path: /path/to/my/project/kubernetes-local-dev/symfony # path to our symfony project
# 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
- mountPath: /var/www/symfony
name: hostvolume
# the php container
- image: localhost:5000/wuestkamp_php
imagePullPolicy: Always
name: php
volumeMounts:
# - mountPath: /var/www/symfony/public
# name: sf-public
- mountPath: /var/www/symfony
name: hostvolume
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