docker-compose.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. ---
  2. version: '3'
  3. # In order to set configuration, please use a .env file in
  4. # your compose project directory (the same directory as your
  5. # docker-compose.yml), and set database options, application
  6. # name, key, and other settings there.
  7. # A list of available settings is available in .env.example
  8. #
  9. # The services should scale properly across a swarm cluster
  10. # if the volumes are properly shared between cluster members.
  11. services:
  12. ## App and Worker
  13. app:
  14. # Comment to use dockerhub image
  15. build:
  16. context: .
  17. dockerfile: contrib/docker/Dockerfile.apache
  18. image: pixelfed
  19. restart: unless-stopped
  20. env_file:
  21. - ./.env.docker
  22. volumes:
  23. - "app-storage:/var/www/storage"
  24. - "app-bootstrap:/var/www/bootstrap"
  25. - "./.env.docker:/var/www/.env"
  26. networks:
  27. - external
  28. - internal
  29. ports:
  30. - "8080:80"
  31. depends_on:
  32. - db
  33. - redis
  34. worker:
  35. build:
  36. context: .
  37. dockerfile: contrib/docker/Dockerfile.apache
  38. image: pixelfed
  39. restart: unless-stopped
  40. env_file:
  41. - ./.env.docker
  42. volumes:
  43. - "app-storage:/var/www/storage"
  44. - "app-bootstrap:/var/www/bootstrap"
  45. networks:
  46. - external
  47. - internal
  48. command: gosu www-data php artisan horizon
  49. depends_on:
  50. - db
  51. - redis
  52. ## DB and Cache
  53. db:
  54. image: mysql:8.0
  55. restart: unless-stopped
  56. networks:
  57. - internal
  58. command: --default-authentication-plugin=mysql_native_password
  59. environment:
  60. - MYSQL_DATABASE=pixelfed
  61. - MYSQL_USER=${DB_USERNAME}
  62. - MYSQL_PASSWORD=${DB_PASSWORD}
  63. - MYSQL_RANDOM_ROOT_PASSWORD=true
  64. volumes:
  65. - "db-data:/var/lib/mysql"
  66. redis:
  67. image: redis:5-alpine
  68. restart: unless-stopped
  69. volumes:
  70. - "redis-data:/data"
  71. networks:
  72. - internal
  73. volumes:
  74. db-data:
  75. redis-data:
  76. app-storage:
  77. app-bootstrap:
  78. networks:
  79. internal:
  80. internal: true
  81. external:
  82. driver: bridge