Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions services/arms/safety-guardian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
# Safety Guardian Arm Dockerfile - Multi-stage build for Python service
FROM python:3.13.7-slim as builder
FROM python:3.14.2-slim as builder

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Upgrading the Python base image is important for security. However, this change as-is will break the Docker build. The COPY instruction on line 41, which copies dependencies from the builder stage, uses a hardcoded path with the old Python version: /usr/local/lib/python3.13/site-packages.

With the base image updated to python:3.14.2-slim, the correct path for site-packages will be /usr/local/lib/python3.14/site-packages. You need to update line 41 to use this new path for both the source and destination of the COPY command.

To make this Dockerfile more robust for future upgrades, consider using a build argument for the Python version. For example:

ARG PYTHON_VERSION_MAJOR_MINOR=3.14
ARG PYTHON_VERSION_FULL=3.14.2
FROM python:${PYTHON_VERSION_FULL}-slim as builder
...
# Runtime stage
FROM python:${PYTHON_VERSION_FULL}-slim
...
COPY --from=builder /usr/local/lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages /usr/local/lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages

Applying this pattern across all your Python Dockerfiles would prevent this kind of issue from recurring.


# Install system dependencies
RUN apt-get update && apt-get install -y \
Expand All @@ -23,7 +23,7 @@ RUN poetry config virtualenvs.create false && \
poetry install --only main --no-interaction --no-ansi

# Runtime stage
FROM python:3.13.7-slim
FROM python:3.14.2-slim

# Install runtime dependencies
RUN apt-get update && apt-get install -y \
Expand Down
Loading