Guest User

Untitled

a guest
Jul 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. # Create a pod containing the PHP-FPM application (my-php-app)
  2. # and nginx, each mounting the `shared-files` volume to their
  3. # respective /var/www/html directories.
  4.  
  5. kind: Pod
  6. apiVersion: v1
  7. metadata:
  8. name: phpfpm-nginx-example
  9. spec:
  10. volumes:
  11. # Create the shared files volume to be used in both pods
  12. - name: shared-files
  13. emptyDir: {}
  14.  
  15. # Add the ConfigMap we declared above as a volume for the pod
  16. - name: nginx-config-volume
  17. configMap:
  18. name: nginx-config
  19.  
  20. containers:
  21. # Our PHP-FPM application
  22. - image: my-php-app:1.0.0
  23. name: app
  24. volumeMounts:
  25. - name: shared-files
  26. mountPath: /var/www/html
  27. # Important! After this container has started, the PHP files
  28. # in our Docker image aren't in the shared volume. We need to
  29. # get them into the shared volume. If we tried to write directly
  30. # to this volume from our Docker image the files wouldn't appear
  31. # in the nginx container.
  32. #
  33. # So, after the container has started, copy the PHP files from this
  34. # container's local filesystem (/app -- added via the Docker image)
  35. # to the shared volume, which is mounted at /var/www/html.
  36. lifecycle:
  37. postStart:
  38. exec:
  39. command: ["/bin/sh", "-c", "cp -r /app/. /var/www/html"]
  40.  
  41. # Our nginx container, which uses the configuration declared above,
  42. # along with the files shared with the PHP-FPM app.
  43. - image: nginx:1.7.9
  44. name: nginx
  45. volumeMounts:
  46. - name: shared-files
  47. mountPath: /var/www/html
  48. - name: nginx-config-volume
  49. mountPath: /etc/nginx/nginx.conf
  50. subPath: nginx.conf
Add Comment
Please, Sign In to add comment