-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
29 lines (24 loc) · 1.04 KB
/
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
FROM python:3.10-slim
# Install uv
# ref: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
gcc python3-dev rsync git-lfs \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# workdir must be the same as the one specified in devcontainer.json
ARG workdir
WORKDIR ${workdir}
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
ENV VIRTUAL_ENV=${workdir}/.venv
# Install the project's dependencies using the lockfile and settings
# ref: https://github.com/astral-sh/uv-docker-example/blob/main/Dockerfile
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
# Installing separately from its dependencies allows optimal layer caching
ADD . ${workdir}
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev