Skip to content

Optimize Docker Images#1722

Merged
tamirkamara merged 8 commits into
mainfrom
tamirkamara/docker-optimize
Sep 21, 2025
Merged

Optimize Docker Images#1722
tamirkamara merged 8 commits into
mainfrom
tamirkamara/docker-optimize

Conversation

@tamirkamara

@tamirkamara tamirkamara commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

Change Description

A few changes to optimize docker images:

  1. Use the right repo for build cache
  2. Add dockerignore to remove things we don't need in the images, mainly the tests folder
  3. Save layers by running apt install once
  4. Use updated syntax for CMD command.
  5. Remove NAME build arg

Checklist

  • I have reviewed the contribution guidelines
  • I have signed the CLA (if required)
  • My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

@tamirkamara tamirkamara requested a review from Copilot September 11, 2025 06:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes Docker images for the Presidio components by modernizing build practices and reducing image size. The changes focus on improving build efficiency, reducing image layers, and using best practices for Docker builds.

  • Remove the unused NAME build argument from all Dockerfiles and docker-compose files
  • Add comprehensive .dockerignore files to exclude test files and development artifacts
  • Consolidate apt install commands to reduce Docker layers and improve caching
  • Update CMD syntax to use exec form for better signal handling

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
presidio-image-redactor/entrypoint.sh New entrypoint script using exec form for proper signal handling
presidio-image-redactor/dockerignore Comprehensive ignore file excluding tests, development files, and build artifacts
presidio-image-redactor/Dockerfile Remove NAME arg, consolidate apt commands, use entrypoint script
presidio-anonymizer/entrypoint.sh New entrypoint script for consistent container startup
presidio-anonymizer/Dockerfile* Remove NAME arg references and update CMD syntax
presidio-analyzer/Dockerfile* Remove NAME arg, consolidate package installs, add cache cleanup
docker-compose*.yml Remove NAME build args and add registry cache references
.github/workflows/*.yml Fix cache repository references to use correct registry paths
Comments suppressed due to low confidence (1)

presidio-anonymizer/entrypoint.sh:3

  • The entrypoint script should validate that the WORKERS and PORT environment variables are set and contain valid values before using them in the command execution.
#!/bin/sh
exec poetry run gunicorn -w "$WORKERS" -b "0.0.0.0:$PORT" "app:create_app()"

Comment thread presidio-image-redactor/entrypoint.sh
Comment thread presidio-image-redactor/dockerignore Outdated
@tamirkamara tamirkamara marked this pull request as ready for review September 11, 2025 07:10
@tamirkamara tamirkamara force-pushed the tamirkamara/docker-optimize branch from d831fc7 to da9f6df Compare September 17, 2025 06:41
Comment thread .github/workflows/ci.yml
Comment thread presidio-image-redactor/Dockerfile
@tamirkamara tamirkamara merged commit ba38d40 into main Sep 21, 2025
34 checks passed
@tamirkamara tamirkamara deleted the tamirkamara/docker-optimize branch September 21, 2025 06:31
prokopidis pushed a commit to prokopidis/presidio that referenced this pull request Jun 23, 2026
* fix docker cache

* optimize docker files

* fix up

* remove NAME build arg

* update ignore files

* fix caching

* /

---------

Co-authored-by: Omri Mendels <omri374@users.noreply.github.com>
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.

4 participants