-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Enhanced Dockerfile for cross compilation #43529
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
Closed
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
6b60df6
Dockerfile: use TARGETVARIANT for frozen images script
crazy-max cc49291
Dockerfile: handle multi base image for riscv64 and armel support
crazy-max 7fad041
Dockerfile: remove hardcoded platform for vpnkit stage
crazy-max 5877916
Dockerfile: add cross compilation helper
crazy-max 439e7e7
Dockerfile: pin criu version and build from source
crazy-max 2c3d94e
Dockerfile: add dummy stage
crazy-max 10f4f72
Dockerfile: containerd cross
crazy-max af7ab21
Dockerfile: runc cross
crazy-max 65cc91d
Dockerfile: tini cross
crazy-max 16f6dca
Dockerfile: rootlesskit cross
crazy-max 0effae3
Dockerfile: containerutility cross
crazy-max 8b56a2e
Dockerfile: verify and better cache for go-swagger stage
crazy-max 4f5c955
Dockerfile: align deps format and output
crazy-max 22c3b89
Dockerfile: use TARGETPLATFORM for delve stage and verify
crazy-max 2a7f462
Dockerfile: verify and better cache for dockercli stage
crazy-max 79a20f2
Dockerfile: use global scope platform args for registry stage and verify
crazy-max 7fe6900
Dockerfile: better cache for crun stage
crazy-max 750330e
Dockerfile: GO111MODULE=on by default
crazy-max 86f9e1e
Dockerfile: enhanced for cross compilation
crazy-max 679bb5f
Dockerfile: add "all" stage to build binaries and extra tools
crazy-max 5100cd9
Dockerfile: smoke test stage and gha workflow
crazy-max b97bb43
Dockerfile: refactor Dockerfile.simple and create gha workflow
crazy-max d511c1e
riscv64 cross comp support
crazy-max 9bfbfda
docs: contributing docs update for cross comp
crazy-max File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| .git | ||
| .go-pkg-cache | ||
| .gopath | ||
| bundles | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: simple | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - 'master' | ||
| - '[0-9]+.[0-9]{2}' | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| validate-dco: | ||
| uses: ./.github/workflows/.dco.yml | ||
|
|
||
| build: | ||
| runs-on: ubuntu-20.04 | ||
| needs: | ||
| - validate-dco | ||
| steps: | ||
| - | ||
| name: Checkout | ||
| uses: actions/checkout@v3 | ||
| - | ||
| name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
| - | ||
| name: Build simple image | ||
| uses: docker/bake-action@v2 | ||
| with: | ||
| targets: simple | ||
| - | ||
| name: Build dynbinary | ||
| run: | | ||
| docker run --rm docker:simple hack/make.sh dynbinary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This concerns me a bit; this can be quite large, and contain a lot of files;
du -sh ./.git 221M ./.git find ./.git -type f | wc -l 6062.gitdirectory (which for me happens a lot, e.g. add / remove branches)docker version), are there other reasons we would need this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes indeed cache would be invalidated quite often to load the context here: https://github.com/moby/moby/pull/43529/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R656. I have checked on ci (fetch depth 0) and loading the context with
.git+ building dockerd and docker-proxy takes ~30sec: https://github.com/moby/moby/runs/7425238835?check_suite_focus=true#step:6:2230. Locally it's even faster for me.Yes this is just to invoke git in https://github.com/moby/moby/pull/43529/files#diff-9eace97aaee3a26c826f37605437498f930565a99a4f072cc476bfeac6199e73R28-R36 if
VERSION,GITCOMMITorBUILDTIMEis empty.Yes we could only rely on ARGs to set
VERSION,GITCOMMITandBUILDTIMEfor sandboxed builds.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(let me copy that code, as the link will break on rebase)
Yeah, leaning toward that, as;
devas "version" is fine, and I know I just built a binary, so I don't really care about build-time)Of course happy to hear other opinions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COPY --ignorewould be real nice :)I think for local dev we'd typically have the source mounted in anyway, in which case we skip the
COPYstep anyway.