Gitea: Docker rootless image size close to twice as big

Created on 15 Nov 2020  路  7Comments  路  Source: go-gitea/gitea

Looks like dockerfile command chown & chmod creates new layer in size of gitea binary that makes image close to twice as big.
see: https://github.com/go-gitea/gitea/blob/master/Dockerfile.rootless#L54
and: https://hub.docker.com/layers/gitea/gitea/latest-rootless/images/sha256-b55c30e134a5ce42aaf3cb94402c3ac98294ffbbb82ea1a70e9c669a586b0441?context=explore

Maybe file could be chown'ed and chmod'ed before building docker image?

kinbuild

Most helpful comment

Should probably switch to docker buildx for cross-platform builds at some point.

https://medium.com/@artur.klauser/building-multi-architecture-docker-images-with-buildx-27d80f7e2408

All 7 comments

ping @sapk

There's a --squash flag on docker build to merge layers but it's been considered experimental for years. Interestingly, it seems not experimental on docker buildx.

Every RUN generally creates a layer so if you want minimum size, either use a single chained RUN or --squash.

yes but that will squash all layers that is not so good as base layers are not reused anymore

btw why linux-amd64|linux-arm64 tags are needed when there is already tag that has both archs in it?

btw why linux-amd64|linux-arm64 tags are needed when there is already tag that has both archs in it?

@lafriks docker manifest needs images to already exist

oh, ok

Should probably switch to docker buildx for cross-platform builds at some point.

https://medium.com/@artur.klauser/building-multi-architecture-docker-images-with-buildx-27d80f7e2408

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lunny picture lunny  路  3Comments

BNolet picture BNolet  路  3Comments

adpande picture adpande  路  3Comments

BRMateus2 picture BRMateus2  路  3Comments

internalfx picture internalfx  路  3Comments