Listory/docker-compose.yml
2022-08-13 00:01:23 +00:00

89 lines
2.2 KiB
YAML

version: "3.4"
# Required for promtail scraping
x-logging: &default-logging
driver: "journald"
options:
tag: "{{.Name}}"
services:
db:
image: postgres:14.5
environment:
POSTGRES_PASSWORD: listory
POSTGRES_USER: listory
POSTGRES_DB: listory
networks:
- db
api:
build:
context: .
target: build-api
command: ["npm", "run", "start:dev"]
environment:
DB_HOST: db
DB_USERNAME: listory
DB_PASSWORD: listory
DB_DATABASE: listory
JWT_SECRET: listory
APP_URL: "http://localhost:3000"
NODE_ENV: local # pretty logs
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:55681/v1/traces
env_file: .env
volumes:
- ./src:/app/src
ports:
- 3000 # API
- "9464:9464" # Metrics
labels:
- "traefik.enable=true" # Enable reverse-proxy for this service
- "traefik.http.routers.api.rule=PathPrefix(`/api`)"
- "traefik.http.routers.api.entrypoints=web"
networks:
- web
- db
logging: *default-logging
frontend:
build:
context: .
target: build-frontend
command: ["npm", "run", "start"]
volumes:
- ./frontend/postcss.config.js:/app/frontend/postcss.config.js:ro
- ./frontend/tailwind.config.js:/app/frontend/tailwind.config.js:ro
- ./frontend/src:/app/frontend/src:ro
- ./frontend/public:/app/frontend/public:ro
ports:
- 3000
labels:
- "traefik.enable=true" # Enable reverse-proxy for this service
- "traefik.http.routers.frontend.rule=PathPrefix(`/`)"
- "traefik.http.routers.frontend.entrypoints=web"
networks:
- web
proxy:
image: traefik:v2.8.3
command:
#- --log.level=debug
#- --accesslog=true
- --api # Enables the web UI
- --api.insecure=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --providers.docker.network=listory_web
- --entrypoints.web.address=:3000
ports:
- "3000:3000" # The HTTP port
- "8080:8080" # The web UI
networks:
- web
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
networks:
db: {}
web: {}