name: fullstack services: frontend: image: frontend:latest build: context: ./frontend target: develop volumes: - frontend_node_modules:/app/frontend/node_modules - ./frontend/:/app/frontend/ labels: - "traefik.http.routers.app.rule=Host(`app.docker.localhost`)" reverse-proxy: image: traefik:latest command: --api.insecure=true --providers.docker ports: - 8888:80 - 8080:8080 volumes: # So that Traefik can listen to the Docker events - /var/run/docker.sock:/var/run/docker.sock backend: image: backend:latest build: context: ./backend labels: - "traefik.http.middlewares.strip-api-prefix.stripprefix.prefixes=/api" - "traefik.http.routers.backend.rule=Host(`app.docker.localhost`) && PathPrefix(`/api`)" - "traefik.http.routers.backend.middlewares=strip-api-prefix@docker" depends_on: db: condition: service_healthy db: image: postgres:latest environment: - POSTGRES_PASSWORD=postgres healthcheck: test: pg_isready --d postgres --user postgres interval: 5s # By default docker compose will create a bridge network using the folder name where the docker-compose.yml # resides and attach all containers in the compose file to that network. This is important because it allows # for easier container to container networking. # Isolate our node_modules from our host system. Docker will handle creating these volumes volumes: frontend_node_modules: backend_node_modules: