DNXLabs / DNXLabs/docker-serverless-python

Support multi-platform

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
bug Hacktoberfest help wanted
Dominant language
Dockerfile
Stars
1
Forks
5
PR merge metrics
No merged PRs in 30d

Description

The comments on the Docker for Mac issue suggests container authors should make containers multi-platform: docker/for-mac#5123 (comment)

By: @stephen-turner
> This is a qemu bug, which is the upstream component we use for running Intel (amd64) containers on M1 (arm64) chips, and is unfortunately not something we control. In general, we recommend running arm64 containers on M1 chips because (even ignoring any crashes) they will always be faster and use less memory.

> Please encourage the author of this container to supply an arm64 or multi-arch image, not just an Intel one. Now that M1 is a mainstream platform, we think that most container authors will be keen to do this.

### Set up QEMU

The [docker/setup-qemu](https://github.com/docker/setup-qemu-action) action installs QEMU [static binaries](https://wiki.debian.org/QemuUserEmulation), which are used to run builders for architectures other than the host.
```
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
```
### Set up Docker builders

The [docker/setup-buildx](https://github.com/docker/setup-buildx-action) action configures [buildx](https://github.com/docker/buildx), which is a Docker CLI plugin that provides enhanced build capabilities. This is the infrastructure that the following step will use for actually building images.

```
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
```

### Build and push the images

This final step uses the [docker/build-push-action][] to build the images and push them to Docker Hub using the tags we defined in the `prep` step. In this example, we’re building images for `amd64`, `arm64`, and `ppc64le` architectures.

```
- name: Build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le
push: true
tags: ${{ steps.prep.outputs.tags }}
```

### References

- https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md
- https://blog.oddbit.com/post/2020-09-25-building-multi-architecture-im/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.