-
Notifications
You must be signed in to change notification settings - Fork 9
/
php-app-deployment.yaml
61 lines (57 loc) · 1.46 KB
/
php-app-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
apiVersion: apps/v1
kind: Deployment
metadata:
name: php-app
labels:
app: php-app
spec:
replicas: 1
selector:
matchLabels:
app: php-app
template:
metadata:
labels:
app: php-app
spec:
volumes:
# Create the shared files volume to be used in both pods
- name: shared-files
emptyDir: {}
# Add the ConfigMap we declared above as a volume for the pod
- name: nginx-config-volume
configMap:
name: nginx-config
containers:
- image: gcr.io/test-project-218312/php-app:latest
name: php-app
volumeMounts:
- name: shared-files
mountPath: /var/www/html
# After the container has started, copy the PHP files from this
# container's local filesystem to the shared volume, which is
# mounted at /var/www/html.
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "cp -r /server/http/public/. /var/www/html"]
- image: nginx:1.15.3-alpine
name: nginx
volumeMounts:
- name: shared-files
mountPath: /var/www/html
- name: nginx-config-volume
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
---
kind: Service
apiVersion: v1
metadata:
name: php-app
spec:
selector:
app: php-app
ports:
- protocol: TCP
port: 8080
targetPort: 80