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

Add example to use docker buildx via the custom builder #5426

Merged
merged 13 commits into from Mar 18, 2021

Conversation

briandealwis
Copy link
Member

Description
This example demonstrates how to use docker buildx as a Skaffold custom builder.

The one downside is that it requires setting up a docker buildx builder instance as a separate step. Something like:

docker buildx create --name skaffold-builder --platform linux/arm64,linux/amd64

We could create a more sophisticated build script that would examine the existing builder instances, but that's a bit more involved.

@briandealwis briandealwis requested a review from a team as a code owner February 20, 2021 15:35
@google-cla google-cla bot added the cla: yes label Feb 20, 2021
@codecov
Copy link

codecov bot commented Feb 20, 2021

Codecov Report

Merging #5426 (ef70183) into master (c1b3f76) will increase coverage by 0.04%.
The diff coverage is n/a.

❗ Current head ef70183 differs from pull request most recent head a08cdb5. Consider uploading reports for the commit a08cdb5 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5426      +/-   ##
==========================================
+ Coverage   71.34%   71.39%   +0.04%     
==========================================
  Files         399      397       -2     
  Lines       14508    14540      +32     
==========================================
+ Hits        10351    10381      +30     
- Misses       3385     3388       +3     
+ Partials      772      771       -1     
Impacted Files Coverage Δ
pkg/skaffold/test/structure/structure.go 86.79% <0.00%> (-13.21%) ⬇️
pkg/skaffold/runner/new.go 67.58% <0.00%> (-1.70%) ⬇️
pkg/skaffold/test/structure/error.go 100.00% <0.00%> (ø)
pkg/skaffold/test/structure/types.go
pkg/skaffold/test/error.go
pkg/skaffold/test/test.go
pkg/skaffold/test/test_factory.go 78.94% <0.00%> (ø)
pkg/skaffold/util/tar.go 56.00% <0.00%> (+5.33%) ⬆️
cmd/skaffold/app/cmd/parse_config.go 78.33% <0.00%> (+6.90%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1b3f76...a08cdb5. Read the comment docs.

integration/examples/custom-buildx/main.go Outdated Show resolved Hide resolved
integration/examples/custom-buildx/Dockerfile Outdated Show resolved Hide resolved
integration/examples/custom-buildx/README.md Outdated Show resolved Hide resolved
custom:
# This buildCommand depends on a `docker buildx` builder to have been created
# with the name `skaffold-builder`:
# $ docker buildx create --name skaffold-builder --platform linux/amd64,linux/arm64
Copy link
Member

Choose a reason for hiding this comment

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

do we also need to add the docker buildx use skaffold-builder command.
or add the --use flag to docker buildx create --name skaffold-builder --platform linux/amd64,linux/arm64 command.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have a slight preference to explicitly specifying the builder with --builder as the message if the user hasn't created a builder and continues to use the default docker builder is cryptic:

error: multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. "docker buildx create --use")

Whereas explicitly specifying --builder xxx where xxx doesn't exist fails with a slightly more coherent message:

error: open /Users/bdealwis/.docker/buildx/instances/foo: no such file or directory

briandealwis and others added 3 commits February 24, 2021 22:59
Co-authored-by: Tejal Desai <tejal29@gmail.com>
Co-authored-by: Tejal Desai <tejal29@gmail.com>
examples/custom-buildx/README.md Outdated Show resolved Hide resolved
examples/custom-buildx/README.md Outdated Show resolved Hide resolved
Rework the README and add a cautionary note on interactions
with artifact caching.
@briandealwis
Copy link
Member Author

PTAL @PriyaModali

examples/custom-buildx/README.md Outdated Show resolved Hide resolved
examples/custom-buildx/README.md Show resolved Hide resolved
examples/custom-buildx/README.md Show resolved Hide resolved
@briandealwis briandealwis merged commit c69c14a into GoogleContainerTools:master Mar 18, 2021
@briandealwis briandealwis deleted the buildx branch March 18, 2021 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants