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

Good Dockerfile: 35% smaller image / 77% fewer CVEs #244

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iximiuz
Copy link

@iximiuz iximiuz commented Feb 18, 2025

[with @kcq] This PR introduces a more optimal Dockerfile that utilizes a multi-stage build to produce a production image with only absolutely necessary components. Plus the new container won't run as root.

The results:

$ docker images podcastfy
REPOSITORY   TAG           IMAGE ID       CREATED              SIZE
podcastfy    slim-ubuntu   8fa6ecf34d32   About a minute ago   1.35GB
podcastfy    python3       ae1c62703189   25 hours ago         1.4GB
podcastfy    original      ada6130f3ef2   25 hours ago         2.11GB

Original image:

$ trivy image ghcr.io/souzatharsis/podcastfy:latest
Total: 1045 (UNKNOWN: 0, LOW: 79, MEDIUM: 963, HIGH: 3, CRITICAL: 0)

Improved image:

$ trivy image podcastfy:slim-ubuntu
Total: 232 (UNKNOWN: 0, LOW: 28, MEDIUM: 204, HIGH: 0, CRITICAL: 0)

This PR introduces a more optimal Dockerfile that utilizes
a multi-stage build to produce a production image with only absolutely
necessary components. Plus the new container won't run as root.

The results:

```
$ docker images podcastfy
REPOSITORY   TAG           IMAGE ID       CREATED              SIZE
podcastfy    slim-ubuntu   8fa6ecf34d32   About a minute ago   1.35GB
podcastfy    python3       ae1c62703189   25 hours ago         1.4GB
podcastfy    original      ada6130f3ef2   25 hours ago         2.11GB
```

Original image:

```
$ trivy image ghcr.io/souzatharsis/podcastfy:latest
Total: 1045 (UNKNOWN: 0, LOW: 79, MEDIUM: 963, HIGH: 3, CRITICAL: 0)
```

Improved image:

```
$ trivy image podcastfy:slim-ubuntu
Total: 232 (UNKNOWN: 0, LOW: 28, MEDIUM: 204, HIGH: 0, CRITICAL: 0)
```
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.

1 participant