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

feat(builder): use docker-buildx plugin to build for non-native platforms #316

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

Conversation

estroz
Copy link
Contributor

@estroz estroz commented Apr 19, 2022

Fixes #312

Supersedes #314 , which adds ~14 MB to the binary and a few new deps while this only adds ~3 MB and one new dep.

What

Leverage docker buildx for multi-platform output image builds

Why

See #312

How Tested

Manually

@ghost
Copy link

ghost commented Apr 19, 2022

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@@ -537,6 +537,30 @@ The `--dockerfile` option makes it possible to build a new minified image direct

The `--use-local-mounts` option is used to choose how the `docker-slim` sensor is added to the target container and how the sensor artifacts are delivered back to the master. If you enable this option you'll get the original `docker-slim` behavior where it uses local file system volume mounts to add the sensor executable and to extract the artifacts from the target container. This option doesn't always work as expected in the dockerized environment where `docker-slim` itself is running in a Docker container. When this option is disabled (default behavior) then a separate Docker volume is used to mount the sensor and the sensor artifacts are explicitly copied from the target container.

#### `docker-buildx` plugin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is worth noting that the report will only report on the host platform's build. Are there any other caveats or edge cases you can think of that are worth noting here @kcq?

@sharq1
Copy link

sharq1 commented Jun 10, 2022

@estroz will this get merged? That's a big PR - would be a shame to leave it and let it have more conflicts 😉

@gthomson31
Copy link

any changes ?
Still issues on M1 builds

@kcq
Copy link
Member

kcq commented Feb 17, 2023

Still issues on M1 builds
@gthomson31 until we have this fully integrated try using the --image-build-engine and potentially --image-build-arch flags. With --image-build-engine=internal Slim will build the output image without using Docker, which might handle the same use case here (building optimized images on non-native platforms). If the target image's architecture isn't picked up properly the --image-build-arch flag should allow you to set it explicitly.

@gthomson31
Copy link

Thank you for the quick response will give that a try out

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.

Allow optimizing amd64 / x86 images on Mac M1 (arm64)
4 participants