From 86f494f840f99eee7500087cea6773eff62a986e Mon Sep 17 00:00:00 2001 From: julius Date: Thu, 18 Dec 2025 19:46:57 +0100 Subject: [PATCH] run with docker compose --- Dockerfile | 17 +++++++++++++++++ compose.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 Dockerfile create mode 100644 compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..93c78b0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM ghcr.io/astral-sh/uv:alpine + +EXPOSE 8000 + +ENV PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 \ + PORT=8000 \ + UV_NO_DEV=1 + +WORKDIR /app +COPY ./pyproject.toml /app/ +RUN uv sync + +COPY . /app +VOLUME ["/app"] + +CMD uv run fastapi run cutt/main.py diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..395c084 --- /dev/null +++ b/compose.yml @@ -0,0 +1,48 @@ +services: + frontend-build: + build: + context: ./frontend + dockerfile: Dockerfile.frontend + container_name: cutt-frontend + environment: + VITE_BASE_URL: ${VITE_BASE_URL} + volumes: + - dist:/app/dist + + backend: + build: . + container_name: cutt-backend + depends_on: + frontend-build: + condition: service_completed_successfully + db: + condition: service_healthy + restart: true + restart: unless-stopped + env_file: + - .env + volumes: + - dist:/app/dist + ports: + - 8000:8000 + + db: + image: postgres:17 + container_name: cutt-db + restart: unless-stopped + volumes: + - db:/var/lib/postgresql + environment: + - POSTGRES_DB=${DB_NAME} + - POSTGRES_USER=${DB_USER} + - POSTGRES_PASSWORD=${DB_PASS} + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] + interval: 10s + retries: 5 + start_period: 30s + timeout: 10s + +volumes: + dist: + db: