docker-compose.yaml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. # recommended by Let's Encrypt
  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. mail:
  82. build: docker/mail
  83. env_file:
  84. - ./docker/mail/mail.env
  85. ports:
  86. - 25:25
  87. - 110:110
  88. - 143:143
  89. - 587:587
  90. - 993:993
  91. volumes:
  92. - ./docker/mail/mail:/var/mail
  93. - ./docker/mail/config:/etc/mail
  94. # Certbot
  95. - ./docker/certbot/www:/var/www/certbot
  96. - ./docker/certbot/.files:/etc/letsencrypt
  97. volumes:
  98. database: