univesper/Dockerfile

40 lines
820 B
Docker

# -------------------------------
# Builder Stage
# -------------------------------
FROM python:3.14-slim AS builder
WORKDIR /app
# Install curl to install uv
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
# Install uv the recommended way
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"
# Copy project files
COPY pyproject.toml .
COPY main.py .
# Create lockfile + install deps
RUN uv sync --no-dev
# -------------------------------
# Runtime Stage
# -------------------------------
FROM python:3.14-slim
WORKDIR /app
# Copy the app and the venv
COPY --from=builder /app/.venv /app/.venv
COPY main.py .
COPY pyproject.toml .
ENV PATH="/app/.venv/bin:${PATH}"
ENV VIRTUAL_ENV="/app/.venv"
RUN mkdir -p /data
CMD ["python", "-u", "main.py"]