Listory/docker-compose.yml

83 lines
2 KiB
YAML

version: "3.4"
services:
db:
image: postgres:12.1
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"
env_file: .env
volumes:
- ./src:/app/src
ports:
- 3000
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
frontend:
build:
context: .
target: build-frontend
command: ["npm", "run", "start"]
volumes:
- ./frontend/postcss.config.js:/app/frontend/postcss.config.js:ro
- ./frontend/src:/app/frontend/src:ro
- ./frontend/public:/app/frontend/public:ro
- tailwind-output:/app/frontend/src/tailwind/
# Workaround for https://github.com/facebook/create-react-app/issues/8688
stdin_open: true
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
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
volumes:
tailwind-output: {}
networks:
db: {}
web: {}