Skip to content

Add mount cache for docker building #34876

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

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

Conversation

lunny
Copy link
Member

@lunny lunny commented Jun 27, 2025

This PR use cache mounts feature of docker to accelerate the docker image build process.
ref: https://docs.docker.com/build/cache/optimize/#use-cache-mounts

Run docker build locally it will take about 242.8s and now it's 16s after cached.

TODO:

  • Add shared cache in CI/CD
    cache-from: type=registry,ref=gitea/gitea:buildcache-v1.24
    cache-to: type=registry,ref=gitea/gitea:buildcache-v1.24,mode=max

@lunny lunny added the topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile label Jun 27, 2025
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 27, 2025
@wxiaoguang
Copy link
Contributor

-> Reduce incremental Docker build times #27998

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jun 27, 2025

One more thing, the rootful and rootless can share the some build and binaries. For example, build rootless first (or a common image first), then copy its binaries (gitea, environment-to-ini) to the rootful image.

(Just a hint, not a must)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/internal topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants