Skip to content

Commit

Permalink
add the Dockerfile (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
jljl1337 authored Dec 20, 2024
1 parent 1173c0e commit 79d7984
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM python:3.13-slim AS base

FROM base AS dependencies

# Install uv
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 --no-editable --compile-bytecode

FROM base AS runner
WORKDIR /app

# Copy the environment
COPY --from=dependencies --chown=app:app /app/.venv /app/.venv

# Copy the application
COPY ./main.py /app

# Run the application
CMD [".venv/bin/python", "main.py"]

0 comments on commit 79d7984

Please sign in to comment.