Add Dockerfile

This commit is contained in:
Marty Oehme 2025-08-20 15:51:40 +02:00
parent ee8a4f69fd
commit d6a87f2b2b
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 36 additions and 0 deletions

5
.dockerignore Normal file
View file

@ -0,0 +1,5 @@
out/
.git/
.jj/
.gitignore

31
Dockerfile Normal file
View file

@ -0,0 +1,31 @@
FROM python:3.13-slim AS base
# FROM ghcr.io/astral-sh/uv:0.8-debian-slim AS builder
#
# WORKDIR /app
#
# COPY pyproject.toml README.md uv.lock ./
#
# RUN uv sync --frozen
#
# COPY . /app
FROM base AS builder
COPY --from=ghcr.io/astral-sh/uv:0.8 /uv /bin/uv
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
WORKDIR /app
COPY uv.lock pyproject.toml /app/
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-install-project --no-dev
COPY . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev
# TODO: Run as non-root user (but careful with output directory ownership)
FROM base AS runtime
WORKDIR /app
ENV PATH="/app/.venv/bin:$PATH"
COPY --from=builder /app /app
ENTRYPOINT ["nightjet"]