This repository has been archived on 2025-06-11. You can view files and clone it, but cannot push or open issues or pull requests.
Files
demystifying-docker-previous/docker-examples/compose/docker-compose.yml
2025-05-14 19:50:09 -04:00

51 lines
1.5 KiB
YAML

services:
frontend:
image: frontend:latest
build:
context: ./frontend
target: develop
volumes:
- frontend_node_modules:/app/node_modules
- ./frontend/src:/app/src
labels:
- "traefik.http.routers.app.rule=Host(`app.docker.localhost`)"
reverse-proxy:
image: traefik:latest
command: --api.insecure=true --providers.docker
ports:
- 80: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
volumes:
- backend_node_modules:/backend/node_modules
- ./backend/:/backend
labels:
- "traefik.http.routers.backend.rule=Host(`app.docker.localhost`) && PathPrefix(`/api`)"
env_file:
- .env
depends_on:
database:
condition: service_healthy
database:
image: postgres:latest
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
env_file:
- .env
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: