27 lines
667 B
Docker
27 lines
667 B
Docker
# Install uv
|
|
FROM python:3.12-slim
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
|
|
# Change the working directory to the `app` directory
|
|
WORKDIR /app
|
|
|
|
# Install dependencies
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
--mount=type=bind,source=uv.lock,target=uv.lock \
|
|
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
|
uv sync --frozen --no-install-project
|
|
|
|
# Copy the project into the image
|
|
ADD . /app
|
|
|
|
# Sync the project
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv sync --frozen
|
|
|
|
# Set the environment variables
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
# Run the application
|
|
CMD ["uv", "run", "main.py"]
|