Skip to content

Commit f237a78

Browse files
committed
Fix up Dockerfile to use Python 3.13 and COPY uv
* Don't need to install uv since we copy it from the uv image which is the recommended way to use uv in Docker. * Copy uv.lock and pyproject.toml specifically. * Install dependencies in a separate step before copying the rest of the project. * Validators is not required to be installed separately * Extra COPY for backend is unneeded since we copy the whole project. * Don't end up running as root, create a non-root user and switch to that user.
1 parent ce08b5a commit f237a78

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

Dockerfile

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,26 @@ RUN npm rebuild esbuild
2020
RUN npm run build
2121

2222
# Stage 2: Build the final application with the backend
23-
FROM python:3.10-slim
23+
FROM python:3.13-slim
24+
25+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
26+
27+
# Run as non-root user in /app
28+
RUN useradd -ms /bin/sh app
29+
USER app
2430
WORKDIR /app
25-
RUN pip install uv
26-
COPY pyproject.toml uv.lock ./
27-
RUN uv sync --no-cache
28-
RUN uv pip install validators
29-
COPY backend/ ./backend/
31+
32+
COPY uv.lock pyproject.toml /app/
33+
# Install dependencies
34+
RUN uv sync --frozen --no-install-project
35+
36+
# Copy the project into the image
37+
COPY . /app
38+
39+
# Sync the project
40+
RUN uv sync --frozen
41+
42+
3043
RUN mkdir -p /app/frontend
3144
COPY --from=frontend-builder /app/public /app/frontend/public
3245

0 commit comments

Comments
 (0)