-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 1.15 KB
/
Dockerfile
File metadata and controls
36 lines (27 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Use a modern, slim Python image
FROM python:3.12-slim-bookworm
# 1. Install 'uv' from its official image
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# 2. Set environment variables
# UV_LINK_MODE=copy: Ensures files are copied (safer for Docker layers) rather than hardlinked
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
# Ensure we use the virtual environment created by uv
ENV PATH="/app/.venv/bin:$PATH"
WORKDIR /app
# 3. Install dependencies FIRST (Caching layer)
# Copy only the lock files to cache this layer if dependencies don't change
COPY pyproject.toml uv.lock ./
# Sync the dependencies:
# --frozen: Fails if lockfile is out of date (good for CI/CD)
# --no-dev: Excludes development dependencies
# --no-install-project: Installs libs but skips installing the app root itself (we copy that later)
RUN uv sync --frozen --no-dev --no-install-project
# 4. Copy the rest of the application
COPY . .
# 5. Initialize DB storage permissions
RUN mkdir -p /app/data && chmod 777 /app/data
EXPOSE 5000
# OLD: CMD ["python", "app.py"]
# NEW: Run with Gunicorn (4 worker processes)
CMD ["gunicorn", "--workers", "4", "--bind", "0.0.0.0:5000", "app:app"]