-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (23 loc) · 884 Bytes
/
Dockerfile
File metadata and controls
32 lines (23 loc) · 884 Bytes
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
FROM python:3.13.4-slim AS builder
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential libpq-dev && rm -rf /var/lib/apt/lists/*
COPY pyproject.toml .
RUN pip install uv && uv venv && uv sync
FROM python:3.13.4-slim
WORKDIR /app
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH="/app/src"
RUN useradd -m app && \
apt-get update && \
apt-get install -y --no-install-recommends libpq5 curl && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p /app/src /data
COPY --from=builder /app/.venv /app/.venv
COPY pyproject.toml alembic.ini categories.json category_labels.es.json ./
COPY --chown=app:app src src
USER app
CMD ["granian","--interface","asgi","--workers","2","--port","9090","server:app"]