Skip to content

Commit 045f4b7

Browse files
committed
Switch back to old Dockerfile
1 parent ef8e809 commit 045f4b7

File tree

1 file changed

+3
-39
lines changed

1 file changed

+3
-39
lines changed

Dockerfile

+3-39
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,8 @@
1-
# Adapted from https://github.com/astral-sh/uv-docker-example
1+
FROM ghcr.io/praekeltfoundation/docker-django-bootstrap-nw:py3.9-bullseye
22

3-
# Use a Python image with uv pre-installed
4-
FROM ghcr.io/astral-sh/uv:python3.10-bookworm AS builder
3+
COPY . /app
54

6-
# Install the project into `/app`
7-
WORKDIR /app
8-
9-
# Enable bytecode compilation
10-
ENV UV_COMPILE_BYTECODE=1
11-
12-
# Copy from the cache instead of linking since it's a mounted volume
13-
ENV UV_LINK_MODE=copy
14-
15-
# Install the project's dependencies using the lockfile and settings
16-
RUN --mount=type=cache,target=/root/.cache/uv \
17-
--mount=type=bind,source=uv.lock,target=uv.lock \
18-
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
19-
uv sync --frozen --no-install-project --no-dev
20-
21-
# Then, add the rest of the project source code and install it
22-
# Installing separately from its dependencies allows optimal layer caching
23-
ADD . /app
24-
RUN --mount=type=cache,target=/root/.cache/uv \
25-
uv sync --frozen --no-dev
26-
27-
28-
# Then, use a final image without uv
29-
FROM ghcr.io/praekeltfoundation/docker-django-bootstrap-nw:py3.10-bullseye
30-
# It is important to use the image that matches the builder, as the path to the
31-
# Python executable must be the same, e.g., using `python:3.11-slim-bookworm`
32-
# will fail.
33-
34-
# Copy the application from the builder
35-
COPY --from=builder --chown=app:app /app /app
36-
37-
RUN pip install uv
38-
RUN uv venv
39-
40-
# Place executables in the environment at the front of the path
41-
ENV PATH="/app/.venv/bin:$PATH"
5+
RUN pip install -e .
426

437
ENV DJANGO_SETTINGS_MODULE "config.settings.production"
448
RUN SECRET_KEY=placeholder ALLOWED_HOSTS=placeholder python manage.py collectstatic --noinput

0 commit comments

Comments
 (0)