version: '3' services: caddy: container_name: caddy image: caddy:2.4.6-alpine restart: unless-stopped depends_on: - frontend ports: - "80:80" - "443:443" volumes: - $PWD/devCaddyfile:/etc/caddy/Caddyfile - ./frontend/dist:/srv - caddy_data:/data - caddy_config:/config networks: - web postgres: image: postgres:11.6 restart: unless-stopped env_file: - .ENV volumes: - ./db:/db networks: - web api: container_name: api restart: unless-stopped image: web build: context: . dockerfile: ./backend/containers/RestDockerFile #TODO do not make migrations in production and change server to guicorn #gunicorn -b 0.0.0.0:8080 --workers=3 api.wsgi command: > bash -c "python wait_for_postgres.py && ./manage.py makemigrations && ./manage.py migrate && ./manage.py runserver 0.0.0.0:8000" volumes: - ./backend:/code/ env_file: - .ENV ports: - "8000:8000" depends_on: - postgres networks: - web #TODO remove the mailhog container for production mailhog: logging: driver: none image: mailhog/mailhog:v1.0.0 expose: - 1025 - 8025 ports: - "8025:8025" - "1025:1025" restart: unless-stopped networks: - web frontend: container_name: frontend #TODO remove logging: for production #logging: # driver: none image: node:15.6.0-alpine3.12 ports: - 3000:3000 #build: # context: . # dockerfile: ./frontend/containers/FrontendDockerFile volumes: - ./frontend:/code/ env_file: - .ENV restart: unless-stopped working_dir: /code/ stdin_open: true entrypoint: "/bin/sh" ###TODO change to npm run build command: "-c \"if [ ! -d \"node_modules\" ]; then npm i; fi; npm run serve \"" networks: - web networks: web: volumes: caddy_data: external: true caddy_config: