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

[FEATURE] Support Python Docker Images #8

Open
duaraghav8 opened this issue Dec 7, 2024 · 1 comment
Open

[FEATURE] Support Python Docker Images #8

duaraghav8 opened this issue Dec 7, 2024 · 1 comment
Labels
feature-request Feature request

Comments

@duaraghav8
Copy link
Owner

Is your feature request related to a problem you're facing?
At the moment, dockershrink only supports docker images for Nodejs applications.
Python images do not get optimized for size.

Describe the solution you'd like
dockershrink optimize can detect whether an image is for a nodejs app or a python app and apply suitable optimizations.

Additional context
This is not a tiny feature, but a very big effort to undertake.
I need more inputs from the community, especially about python-specific strategies to reduce image size that we can implement.
This issue will help us understand what python support should look like (at least the initial release of it)

@duaraghav8 duaraghav8 added the feature-request Feature request label Dec 7, 2024
@devopswithnaman
Copy link

Hi Raghav,

To identify the language or runtime used in a Dockerfile, we can follow a few approaches:

  1. Check the Builder Stage: If the Dockerfile uses a builder stage, like FROM python or FROM node, it can directly indicate whether it's Python or Node.js.
  2. Analyze Base Images: For base images like ubuntu, we can examine subsequent layers (RUN commands) to see if they install Node.js, Python, or related dependencies.
  3. File Analysis: Inspect the files being copied or used in the Dockerfile (e.g., .py for Python, .js for Node.js) to understand the runtime.
  4. Environment Variables: Look for clues like ENV FLASK_APP=app.py or ENV NODE_ENV=production.
  5. Ports and Commands: EXPOSE ports (e.g., 3000 for Node.js, 5000 for Flask) and CMD/ENTRYPOINT directives can provide additional hints.

Also, maybe we can use AI to understand what language is it using and build accordingly.
If you want i can pick this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Feature request
Projects
None yet
Development

No branches or pull requests

2 participants