From 79d7984e3d153917f3d46dad5e8872270d31bff3 Mon Sep 17 00:00:00 2001 From: jljl1337 <43352209+jljl1337@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:34:31 -0700 Subject: [PATCH] add the Dockerfile (#6) --- Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a56f80c --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file