docker-compose.fragment.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/sh
  2. cat <<EOF
  3. nginx:
  4. image: nginx:alpine
  5. EOF
  6. # If the user wants a PHP docker container
  7. if echo "${DOCKER}" | grep -Fq '"php"'; then
  8. cat <<EOF
  9. depends_on:
  10. - php
  11. EOF
  12. fi
  13. cat <<EOF
  14. restart: always
  15. tty: false
  16. ports:
  17. - "${NGINX_HTTP_PORT}:80"
  18. - "${NGINX_HTTPS_PORT}:443"
  19. volumes:
  20. # Nginx
  21. - ./docker/nginx/nginx.conf:/var/nginx/social.conf
  22. - ./docker/nginx/domain.sh:/var/nginx/domain.sh
  23. # Certbot
  24. - ./docker/certbot/www:/var/www/certbot
  25. - ./docker/certbot/.files:/etc/letsencrypt
  26. # social
  27. - ./public:/var/www/social/public
  28. env_file:
  29. - ./docker/bootstrap/bootstrap.env
  30. - ./docker/db/db.env
  31. EOF
  32. # If the user wants a Certbot docker container
  33. if echo "${DOCKER}" | grep -Fq '"certbot"'; then
  34. cat <<EOF
  35. command: /bin/sh -c '/var/nginx/domain.sh;
  36. while :; do
  37. sleep 6h & wait \$\${!};
  38. nginx -s reload;
  39. done &
  40. nginx -g "daemon off;"'
  41. EOF
  42. else
  43. cat <<EOF
  44. command: 'nginx -g \"daemon off;\"'
  45. EOF
  46. fi