docker-compose.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. version: '3.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/postgres/data
  71. env_file:
  72. - ./docker/db/db.env
  73. volumes:
  74. - database:/var/lib/postgres/data
  75. redis:
  76. image: redis:alpine
  77. restart: always
  78. tty: false
  79. ports:
  80. - 6379:6379
  81. volumes:
  82. database: