@@ -21,25 +21,35 @@ WORKDIR /home/harambe/project
2121# NOTE: In CI, you need to cache `uv.lock` (or create it if it doesn't exist)
2222COPY pyproject.toml uv.lock ./
2323
24- # NOTE: Needed to mock version for `setuptools-scm` (pass at build time)
25- ARG APE_VERSION
26- ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ETH_APE=${APE_VERSION}
27-
24+ # UV Configurations
25+ # NOTE: use system python (better for our images, that inherit from `python:$VERSION`)
26+ ENV UV_MANAGED_PYTHON=false
27+ # NOTE: skip installing dev-only dependencies
28+ ENV UV_NO_DEV=true
29+ # NOTE: use `uv.lock` that we loaded into build
30+ ENV UV_FROZEN=true
31+ # NOTE: installs everything as non-editable (faster)
32+ ENV UV_NO_EDITABLE=true
33+ # NOTE: improves load speed of dependencies
34+ ENV UV_COMPILE_BYTECODE=true
2835# NOTE: link mode "copy" silences warnings about hard links in other commands
2936ENV UV_LINK_MODE=copy
3037
3138# Install dependencies first
32- # NOTE: --compile-bytecode improves load speed of dependencies
39+ # NOTE: --no-install-project so that we have our dependencies built first (speeds up incremental builds)
3340RUN --mount=type=cache,target=/root/.cache/uv \
34- uv sync --frozen --no-install-project --no-editable --compile-bytecode
41+ uv sync --no-install-project
42+
43+ # NOTE: Needed to mock version for `setuptools-scm` (pass at build time)
44+ ARG APE_VERSION
45+ ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ETH_APE=${APE_VERSION}
3546
3647# Now copy Ape's source code over
3748COPY src src
3849
3950# Install Ape using pre-installed dependencies
40- # NOTE: --compile-bytecode improves load speed of dependencies
4151RUN --mount=type=cache,target=/root/.cache/uv \
42- uv sync --frozen --no-editable --compile-bytecode
52+ uv sync
4353
4454# Stage 2: Slim image (ape core only)
4555
@@ -48,6 +58,7 @@ FROM python:${PYTHON_VERSION}-slim AS slim
4858# NOTE: Add a bespoke user to run commands with
4959RUN useradd --create-home --shell /bin/bash harambe
5060WORKDIR /home/harambe/project
61+ RUN chown harambe:harambe .
5162
5263COPY --from=slim-builder --chown=harambe:harambe \
5364 /home/harambe/project/.venv /home/harambe/project/.venv
@@ -68,15 +79,15 @@ FROM slim-builder AS full-builder
6879
6980# Install recommended plugins
7081RUN --mount=type=cache,target=/root/.cache/uv \
71- uv sync --frozen --no-editable --compile-bytecode -- extra recommended-plugins
82+ uv sync --extra recommended-plugins
7283
7384# Stage 4: Full image (slim with recommended plugins from full-builder)
7485
7586FROM slim AS full
7687
7788# Install anvil (for the Foundry plugin to be useful)
7889# NOTE: Adds 33MB to build
79- COPY --from=ghcr.io/foundry-rs/foundry:latest \
90+ COPY --from=ghcr.io/foundry-rs/foundry:stable \
8091 /usr/local/bin/anvil /home/harambe/.local/bin/anvil
8192
8293COPY --from=full-builder --chown=harambe:harambe \
0 commit comments