Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile to Multi-Stage #1921

Closed
wants to merge 1 commit into from

Conversation

multi-stager
Copy link

Overview

Hi,

Thanks for maintaining pygeoapi. I represent a research group investigating multi-stage builds. We recently refactored your Dockerfile to a multi-stage Dockerfile and found that it brings the following benefits:

✅ Reduced final image size (from 1236MB to 101MB)
✅ Minimized image vulnerabilities (verified via Trivy, from 890 to 47)

We hope this small improvement to the Dockerfile will be useful to you :)

Thanks,

Related Issue / discussion

None

Additional information

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

@justb4 justb4 requested review from totycro, kalxas and justb4 February 4, 2025 12:10
@justb4 justb4 added the enhancement New feature or request label Feb 4, 2025
Copy link
Member

@justb4 justb4 left a comment

Choose a reason for hiding this comment

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

This kind of contribution is very welcome as the Docker Image needs slimming. And multi-staged is one of the ways to go.
But...unfortunately it is not as easy as just copying the /pygeoapi directory in the target image. If you look at the Dockerfile you will see that a whole list of Debian and Python packages are installed, plus additional resources. Those are also required in the final Docker Image.

@multi-stager
Copy link
Author

@justb4 You're right — our current multi-stage approach misses critical dependencies. We'll refine the split to properly slim the image while preserving functionality. Appreciate the feedback!

@tomkralidis
Copy link
Member

Closing. echo @justb4's comments. Suggest discussing in #1753 to gain clarity and consensus as a first step.

@tomkralidis tomkralidis closed this Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants