-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (24 loc) · 776 Bytes
/
Dockerfile
File metadata and controls
36 lines (24 loc) · 776 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
33
34
35
36
# ---------- Stage 1: Builder (Debian-based) ----------
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
WORKDIR /app
# Copy lockfiles
COPY pyproject.toml uv.lock ./
# Install dependencies into .venv
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-install-project --no-dev
# ---------- Stage 2: Runtime (Debian-based) ----------
FROM python:3.12-slim
WORKDIR /app
# Copy the venv from the builder
COPY --from=builder /app/.venv /app/.venv
# Copy source code
COPY ./src /app/src
# Set environment variables
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONPATH=/app
# Ensure logs dir exists
RUN mkdir -p /app/logs && chmod -R 777 /app/logs
EXPOSE 8080
CMD ["python", "src/__main__.py"]