initial commit
This commit is contained in:
33
Dockerfile
Normal file
33
Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
# Install uv (copy from the official image rather than curl)
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
|
||||
# Set environment variables
|
||||
# - Activate the venv by putting it at the front of the PATH
|
||||
# - Compile bytecode for faster startup
|
||||
ENV PATH="/app/.venv/bin:$PATH" \
|
||||
UV_COMPILE_BYTECODE=1 \
|
||||
UV_LINK_MODE=copy
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
# Copy only the files needed to resolve dependencies first (better caching)
|
||||
COPY pyproject.toml uv.lock* ./
|
||||
|
||||
# Sync dependencies without installing the project itself yet
|
||||
RUN uv sync --frozen --no-install-project --no-dev
|
||||
|
||||
# Copy source code and install the project
|
||||
COPY src /app/src
|
||||
RUN uv sync --frozen --no-dev
|
||||
|
||||
# Runtime configuration
|
||||
ARG APP
|
||||
ENV APP=$APP
|
||||
ENV PYTHONPATH=$APP/src/:$PYTHONPATH
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Because PATH is updated, "python" now points to the venv python
|
||||
CMD ["python", "src/main.py"]
|
||||
Reference in New Issue
Block a user