-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (27 loc) · 962 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
30
31
32
33
34
35
36
37
38
39
40
41
FROM python:3.12-slim-bookworm AS base
WORKDIR /opt
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
PYTHONDONTWRITEBYTECODE=off \
PYTHONFAULTHANDLER=on \
PYTHONUNBUFFERED=on
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY pyproject.toml uv.lock ./
COPY packages packages
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=packages,target=packages \
--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
FROM base AS dev
WORKDIR /opt/dev
ENV PATH="/opt/.venv/bin:$PATH"
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --group migration --frozen --no-install-project
FROM python:3.12-slim-bookworm AS prod
WORKDIR /opt
ENV PATH="/opt/.venv/bin:$PATH"
COPY --from=base /opt/.venv .venv
COPY app app
COPY packages packages
CMD ["python", "-m", "app", "server", "up"]