docker-compose.yaml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. version: '3'
  2. services:
  3. nginx:
  4. image: nginx:alpine
  5. depends_on:
  6. - php
  7. restart: always
  8. # tty: false
  9. ports:
  10. - 80:80
  11. - 443:443
  12. volumes:
  13. # Nginx
  14. - ./docker/nginx/nginx.conf:/var/nginx/social.conf
  15. - ./docker/nginx/domain.sh:/var/nginx/domain.sh
  16. # Certbot
  17. - ./docker/certbot/www:/var/www/certbot
  18. - ./docker/certbot/files:/etc/letsencrypt
  19. # Social
  20. - ./public:/var/www/social/public
  21. env_file:
  22. - ./docker/bootstrap/bootstrap.env
  23. - ./docker/db/db.env
  24. command: /bin/sh -c '/var/nginx/domain.sh;
  25. while :; do
  26. sleep 6h & wait $${!};
  27. nginx -s reload;
  28. done &
  29. nginx -g "daemon off;"'
  30. certbot:
  31. image: certbot/certbot
  32. depends_on:
  33. - nginx
  34. # Check for certificate renewal every 12h as
  35. # recomnended by Let's Encryot
  36. entrypoint: /bin/sh -c 'trap exit TERM;
  37. while :; do
  38. certbot renew > /dev/null;
  39. sleep 12h & wait $${!};
  40. done'
  41. volumes:
  42. - ./docker/certbot/www:/var/www/certbot
  43. - ./docker/certbot/files:/etc/letsencrypt
  44. php:
  45. build: docker/php
  46. depends_on:
  47. - db
  48. restart: always
  49. tty: true
  50. ports:
  51. - 9000:9000
  52. volumes:
  53. # Entrypoint
  54. - ./docker/php/entrypoint.sh:/entrypoint.sh
  55. - ./docker/db/wait_for_db.sh:/wait_for_db.sh
  56. - ./docker/social/install.sh:/var/entrypoint.d/social_install.sh
  57. # Main files
  58. - .:/var/www/social
  59. env_file:
  60. - ./docker/social/social.env
  61. - ./docker/db/db.env
  62. command: /entrypoint.sh
  63. db:
  64. image: postgres:alpine
  65. restart: always
  66. tty: false
  67. ports:
  68. - 5432:5432
  69. environment:
  70. - PGDATA=/var/lib/postgresql/data
  71. env_file:
  72. - ./docker/db/db.env
  73. volumes:
  74. - database:/var/lib/postgresql/data
  75. volumes:
  76. database: