Skip to content

Reduce container size #352

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

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

Conversation

evilhamsterman
Copy link

The Dockerfile for these images would copy in the image file then run qemu-img resize IMAGE DISK_SIZE, because of the way container layers work that means you end up with two copies of the image in the container, one of which is unusable. This effectively doubles the container size.

Also I added --no-install-recommends as without it hundreds of unneeded packages such as fonts are installed.

This takes the Ubuntu image from 2.24GB to 950MB

Copy link
Owner

@hellt hellt left a comment

Choose a reason for hiding this comment

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

thanks @evilhamsterman !
I had a few comments; nothing too major

@@ -1,10 +1,22 @@
FROM public.ecr.aws/docker/library/debian:bookworm-slim
Copy link
Owner

Choose a reason for hiding this comment

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

we should keep the ecr.aws registry. Docker's pull limits are the reason

COPY $IMAGE* /
RUN qemu-img resize /$IMAGE $DISK_SIZE

FROM debian:bookworm-slim
Copy link
Owner

Choose a reason for hiding this comment

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

same comment for the image registry as above

COPY *.py /
COPY --chmod=0755 backup.sh /
Copy link
Owner

Choose a reason for hiding this comment

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

we need to keep the backup file

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.

2 participants