Add fullstack example
This commit is contained in:
51
examples/fullstack/docker-compose.yml
Normal file
51
examples/fullstack/docker-compose.yml
Normal file
@ -0,0 +1,51 @@
|
||||
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:
|
Reference in New Issue
Block a user