feat: add Docker deployment configuration

Add backend and frontend Dockerfiles, docker-compose setup with nginx
reverse proxy, .dockerignore files and Makefile for dev/prod workflows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 05:33:41 +01:00
parent 4f0ca67dc4
commit d271697d43
7 changed files with 104 additions and 0 deletions

14
.dockerignore Normal file
View File

@@ -0,0 +1,14 @@
.git
.venv
venv
__pycache__
*.pyc
node_modules
frontend/dist
data
*.egg-info
.mypy_cache
.ruff_cache
.pytest_cache
.vscode
.idea

17
Makefile Normal file
View File

@@ -0,0 +1,17 @@
.PHONY: dev_back dev_front dev docker
# Backend avec auto-reload uvicorn
dev_back:
uv run plesna-gerance serve --reload
# Frontend avec hot-reload Vite
dev_front:
cd frontend && npm run dev
# Lance les deux en parallèle
dev:
$(MAKE) dev_back & $(MAKE) dev_front & wait
# Build et lance via podman-compose
docker:
podman-compose up --build

19
backend.Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM python:3.12-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends poppler-utils && \
rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
COPY src/ src/
RUN uv sync --frozen --no-dev
EXPOSE 8000
CMD ["uv", "run", "plesna-gerance", "serve", "--host", "0.0.0.0"]

21
docker-compose.yml Normal file
View File

@@ -0,0 +1,21 @@
services:
backend:
build:
context: .
dockerfile: backend.Dockerfile
volumes:
- ./data:/app/data
environment:
- PLESNA_DB_PATH=/app/data/database.sqlite
- PLESNA_STORAGE_PATH=/app/data/documents
restart: unless-stopped
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "8080:80"
depends_on:
- backend
restart: unless-stopped

2
frontend/.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
node_modules
dist

12
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

19
frontend/nginx.conf Normal file
View File

@@ -0,0 +1,19 @@
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
# Proxy API requests to backend
location /api {
proxy_pass http://backend:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50M;
}
# SPA fallback
location / {
try_files $uri $uri/ /index.html;
}
}