Files
url-shortener/compose.yaml
T
2025-11-23 20:42:56 +01:00

92 lines
3.0 KiB
YAML

services:
backend:
build: ./backend
container_name: ${STACK_NAME?Variable not set}_backend
restart: always
volumes:
- db_data:/app/prisma
entrypoint: sh -c "bun prisma migrate deploy && bun start"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:${PORT:-3000}/api/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
networks:
- proxy
env_file: .env
environment:
- DATABASE_URL=${DATABASE_URL}
- JWT_SECRET=${JWT_SECRET:-your_jwt_secret}
- SIGNUP_ENABLED=${SIGNUP_ENABLED:-"true"}
- CORS_ORIGIN=${CORS_ORIGIN:-*}
- PORT=${PORT:-3000}
labels:
- traefik.enable=true
- traefik.docker.network=proxy
- traefik.constraint-label=proxy
- traefik.http.services.${STACK_NAME}-backend.loadbalancer.server.port=3000
- "traefik.http.routers.${STACK_NAME}-backend-http.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}-backend-http.entrypoints=web"
- "traefik.http.routers.${STACK_NAME}-backend-http.service=${STACK_NAME}-backend"
studio:
build: ./backend
container_name: ${STACK_NAME}_prisma_studio
restart: always
depends_on:
backend:
condition: service_healthy
restart: true
volumes:
- db_data:/app/prisma
entrypoint: sh -c "bun prisma studio --hostname 0.0.0.0"
expose:
- 5555
networks:
- proxy
env_file: .env
environment:
- DATABASE_URL=${DATABASE_URL}
labels:
- traefik.enable=true
- traefik.docker.network=proxy
- traefik.http.services.${STACK_NAME}-studio.loadbalancer.server.port=5555
- "traefik.http.routers.${STACK_NAME}-studio.rule=Host(`studio.${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}-studio.entrypoints=web"
- "traefik.http.routers.${STACK_NAME}-studio.service=${STACK_NAME}-studio"
- traefik.http.routers.${STACK_NAME}-studio.middlewares=${STACK_NAME}-studio-basicauth
- traefik.http.middlewares.${STACK_NAME}-studio-basicauth.basicauth.users=${PRISMA_USERNAME}:${PRISMA_PASSWORD}
frontend:
build:
context: ./frontend
args:
- VITE_DOMAIN=${VITE_DOMAIN}
- VITE_API_BASE_URL=${VITE_API_BASE_URL}
- VITE_SIGNUP_ENABLED=${SIGNUP_ENABLED}
container_name: ${STACK_NAME?Variable not set}_frontend
restart: always
depends_on:
backend:
condition: service_healthy
restart: true
networks:
- proxy
env_file: .env
labels:
- traefik.enable=true
- traefik.docker.network=proxy
- traefik.constraint-label=proxy
- traefik.http.services.${STACK_NAME}-frontend.loadbalancer.server.port=80
- "traefik.http.routers.${STACK_NAME}-frontend-http.rule=Host(`short.${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}-frontend-http.entrypoints=web"
- "traefik.http.routers.${STACK_NAME}-frontend-http.service=${STACK_NAME}-frontend"
volumes:
db_data:
driver: local
networks:
proxy:
name: proxy