From a091895998a181aeb7aa4898a718e4032dc73747 Mon Sep 17 00:00:00 2001 From: Fusion Date: Thu, 14 May 2026 02:08:53 +0200 Subject: [PATCH] fix(FN-002): address Dockerfile build order, base images, .dockerignore, docs --- apps/api/.dockerignore | 15 +++++++++++++++ apps/api/Dockerfile | 5 ++--- apps/web/.dockerignore | 6 ++++++ apps/web/Dockerfile | 2 +- docker-compose.yml | 8 ++++++-- docs/README.md | 2 +- docs/development.md | 12 +++++------- 7 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 apps/api/.dockerignore create mode 100644 apps/web/.dockerignore diff --git a/apps/api/.dockerignore b/apps/api/.dockerignore new file mode 100644 index 0000000..4546fea --- /dev/null +++ b/apps/api/.dockerignore @@ -0,0 +1,15 @@ +__pycache__/ +*.py[cod] +*$py.class +*.so +.venv/ +venv/ +ENV/ +env/ +*.egg-info/ +dist/ +build/ +.git/ +.env +.env.local +*.log diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 0793f1d..717540f 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -1,15 +1,14 @@ -FROM python:3.14-slim +FROM python:3.12-slim WORKDIR /app ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 +COPY app/ ./app/ COPY pyproject.toml ./ RUN pip install --no-cache-dir -e ".[dev]" -COPY app/ ./app/ - EXPOSE 8000 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/apps/web/.dockerignore b/apps/web/.dockerignore new file mode 100644 index 0000000..390f589 --- /dev/null +++ b/apps/web/.dockerignore @@ -0,0 +1,6 @@ +node_modules/ +dist/ +.git/ +.env +.env.local +*.log diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 9719b64..f624c23 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -1,4 +1,4 @@ -FROM node:25-alpine AS builder +FROM node:22-alpine AS builder WORKDIR /app COPY package.json ./ diff --git a/docker-compose.yml b/docker-compose.yml index 7101348..b987b78 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,12 @@ services: depends_on: db: condition: service_healthy + healthcheck: + test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8000/health')\""] + interval: 10s + timeout: 5s + retries: 3 + start_period: 5s volumes: - api-data:/data restart: unless-stopped @@ -22,8 +28,6 @@ services: dockerfile: Dockerfile ports: - "5173:80" - env_file: - - .env depends_on: - api restart: unless-stopped diff --git a/docs/README.md b/docs/README.md index 872e746..29dedb5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,5 +11,5 @@ This directory contains architecture, development, and deployment documentation ## Quick Links - Root README — to be added in Step 6 -- Deploy Skeleton — to be added in Step 5 +- [Deploy Skeleton](../deploy/README.md) - [Project Brief](project-brief.md) — Original product brief and confirmed stack *(FN-001)* diff --git a/docs/development.md b/docs/development.md index 99b132e..010964d 100644 --- a/docs/development.md +++ b/docs/development.md @@ -55,11 +55,9 @@ pnpm dev # Runs frontend and backend in parallel ### With Docker Compose -> Docker Compose files will be added in Step 5. Once created, run: -> -> ```bash -> docker compose up --build -d -> ``` +```bash +docker compose up --build -d +``` ## Testing @@ -129,8 +127,8 @@ pnpm build │ ├── web/ # Vite React TypeScript frontend │ └── api/ # FastAPI Python backend ├── docs/ # Documentation -├── deploy/ # Deployment skeleton files (added in Step 5) -├── docker-compose.yml (added in Step 5) +├── deploy/ # Deployment skeleton files +├── docker-compose.yml └── package.json # Root monorepo scripts ```