-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (20 loc) · 828 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# The python version here does not acctually matter since it will
# be overriden by `uv` when creating a virtual environment.
FROM python:slim-bookworm
WORKDIR /app
ENV PYTHONUNBUFFERED=1
COPY --from=ghcr.io/astral-sh/uv:0.4.28 /uv /uvx /bin/
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
RUN groupadd -r app-group && \
useradd -r -g app-group -d /app -s /bin/bash app-user && \
chown -R app-user:app-group /app
USER app-user
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-dev -v
COPY . .
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev -v
ENV PATH="/app/.venv/bin:$PATH"
ENTRYPOINT ["python3", "package/main.py"]