Files
2024-01-25 12:54:01 +01:00

111 lines
3.2 KiB
YAML

services:
php:
container_name: php
build:
context: .
target: open_marketplace_php_prod
depends_on:
- migrations
environment:
APP_DEBUG: 0
APP_ENV: prod
APP_SECRET: EDITME
DATABASE_URL: mysql://open_marketplace:${MYSQL_PASSWORD}@mysql/open_marketplace_prod
MAILER_URL: smtp://localhost
MESSENGER_TRANSPORT_DSN: doctrine://default
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
volumes:
# use a bind-mounted host directory, as we want to keep the sessions
- ./var/sessions:/srv/open_marketplace/var/sessions:rw
# use a bind-mounted host directory, as we want to keep the media
- ./public/media:/srv/open_marketplace/public/media:rw
networks:
- open_marketplace
cron:
container_name: cron
build:
context: .
target: open_marketplace_cron
depends_on:
- migrations
environment:
APP_ENV: prod
APP_DEBUG: 0
APP_SECRET: EDITME
DATABASE_URL: mysql://open_marketplace:${MYSQL_PASSWORD}@mysql/open_marketplace_prod
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
networks:
- open_marketplace
worker:
container_name: worker
command: ["php", "bin/console", "messenger:consume", "main", "catalog_promotion_removal", "--limit=5", "--memory-limit=256M", "--time-limit=600"]
restart: always
build:
context: .
target: open_marketplace_php_prod
depends_on:
- migrations
environment:
APP_ENV: prod
APP_DEBUG: 0
APP_SECRET: EDITME
DATABASE_URL: mysql://open_marketplace:${MYSQL_PASSWORD}@mysql/open_marketplace_prod
MESSENGER_TRANSPORT_DSN: doctrine://default
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
networks:
- open_marketplace
migrations:
container_name: migrations
build:
context: .
target: open_marketplace_migrations_prod
depends_on:
- mysql
environment:
APP_ENV: prod
APP_DEBUG: 0
APP_SECRET: EDITME
DATABASE_URL: mysql://open_marketplace:${MYSQL_PASSWORD}@mysql/open_marketplace_prod
LOAD_FIXTURES: ${LOAD_FIXTURES:-0}
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
networks:
- open_marketplace
mysql:
container_name: mysql
# in production, we may want to use a managed database service
image: mysql:5.7 # Sylius is fully working on mysql 8.0 version
environment:
MYSQL_RANDOM_ROOT_PASSWORD: true
MYSQL_DATABASE: open_marketplace_prod
MYSQL_USER: open_marketplace
MYSQL_PASSWORD: ${MYSQL_PASSWORD:?MYSQL_PASSWORD is not set or empty}
volumes:
# use a bind-mounted host directory, because we never want to lose our data!
- ./docker/mysql/data:/var/lib/mysql:rw,delegated
networks:
- open_marketplace
nginx:
container_name: nginx
# in production, we may want to use a static website hosting service
build:
context: .
target: open_marketplace_nginx
depends_on:
- php
volumes:
# use a bind-mounted host directory, as we want to keep the media
- ./public/media:/srv/open_marketplace/public/media:ro
networks:
- open_marketplace
ports:
- 80:80
networks:
open_marketplace:
driver: bridge