Skip to content

chore(docker): harden python 3.12 base image for snyk#103

Merged
agjharms merged 4 commits into
mainfrom
fix/dockerfile-python312-bookworm-snyk
Jun 4, 2026
Merged

chore(docker): harden python 3.12 base image for snyk#103
agjharms merged 4 commits into
mainfrom
fix/dockerfile-python312-bookworm-snyk

Conversation

@qplevier

@qplevier qplevier commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

This pull request updates the Docker build process and improves test compatibility with custom logging. The most significant changes include switching to an Alpine-based Python image for the Docker build and ensuring test loggers are compatible with XNATPy's logging expectations.

Docker build improvements:

  • Switched the base image in Dockerfile from python:3.12-slim to python:3.12-alpine3.22 for a smaller and potentially more secure image, and updated the user creation command to use Alpine's adduser. Also added explicit apk update and apk upgrade steps for package freshness.

Test logging compatibility:

  • In tests/img2catalog/xnatpy_fixtures.py, added a verbose alias to the logger if it doesn't exist, ensuring compatibility with XNATPy's custom logging calls during tests.

The help of Github Copilot was used in making this PR

Copilot AI review requested due to automatic review settings June 2, 2026 10:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Hardens the Docker image to address Snyk findings by pinning the Python base image to a specific Debian release and applying available security upgrades during build.

Changes:

  • Pin base image from python:3.12-slim to python:3.12-alpine3.22.
  • Add apk update && apk upgrade (with apt list cleanup) to pick up OS-level security patches.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@qplevier qplevier force-pushed the fix/dockerfile-python312-bookworm-snyk branch from 605c2d5 to b7fcbd1 Compare June 2, 2026 10:17
@sonarqubecloud

sonarqubecloud Bot commented Jun 2, 2026

Copy link
Copy Markdown

@agjharms agjharms merged commit 0da7b16 into main Jun 4, 2026
20 checks passed
@agjharms agjharms deleted the fix/dockerfile-python312-bookworm-snyk branch June 4, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants