Skip to content

Add Docker workflow. Add ARM build.#745

Merged
jessepeterson merged 5 commits intomicromdm:mainfrom
williamtheaker:wt.docker
Oct 11, 2021
Merged

Add Docker workflow. Add ARM build.#745
jessepeterson merged 5 commits intomicromdm:mainfrom
williamtheaker:wt.docker

Conversation

@williamtheaker
Copy link
Contributor

This adds a Github Actions workflow to build a multi-architecture Docker image when new release tags are added. Additionally, support for building ARM images is added.

Here's my most recent action run which generated builds for Github's container registry and Docker Hub

This assumes you have enabled Github Container Registry for the micromdm organization and added a Github Actions secret named DOCKER_HUB_ACCESS_TOKEN with a Docker Hub token.

@jessepeterson
Copy link
Member

I like the idea of encouraging diversification of container registries by not including Docker Hub (even at the added end-user expense/learning curve of not being able to "find" it easily). What do you think about removing the publish step to DH? In the end I would defer to @groob for the final verdict. :)

@williamtheaker
Copy link
Contributor Author

I'm all for decentralization. Heck I wish we were discussing this on Gitlab or Sourcehut. Centralizing image distribution by solely using GHCR doesn't seem like an effective measure to encourage the adoption of other image registries though.

From a purely technical aspect, Docker/Kubernetes tooling already privileges Docker Hub:
If you don't specify a registry hostname, Kubernetes assumes that you mean the Docker public registry. - k8s documentation.
If you run docker info, docker.io is the default registry. The same is true for Red Hat's podman.

By leaving up the Docker Hub images, we're adding an undocumented implicit distinction, where you need to know that a hostname prefix is required in your image tag in order to avoid downloading an image from February 2017. If you're not following Docker Inc's slow decay, it's difficult to tell which is correct image: micromdm/micromdm:latest vs image: ghcr.io/micromdm/micromdm:latest

Are there plans to delete the micromdm Docker Hub repository? Otherwise this PR is adding a bit of automation to a footgun.

I see @khawaga and @nielshojen maintain micromdm images on quay.io and Docker Hub respectively, if they'd like to chime in.

@jessepeterson
Copy link
Member

Centralizing image distribution by solely using GHCR doesn't seem like an effective measure to encourage the adoption of other image registries though.

How do you describe effective measures? At the very least omitting DH doesn't perpetuate the naive use of a de facto registry which I think is better than nothing.

If you run docker info, docker.io is the default registry. The same is true for Red Hat's podman.

This is exactly my point. By not using those default registries it's a sort of forcing function for those less familiar with other registries to at least become familiar with alternatives.

we're adding an undocumented implicit distinction

That's why we'd document it. :)

Are there plans to delete the micromdm Docker Hub repository? Otherwise this PR is adding a bit of automation to a footgun.

Yes. We deleted the micromdm/scep DH repo already. I assumed MicroMDM was in line as well once alternatives were sorted. :)

@williamtheaker
Copy link
Contributor Author

williamtheaker commented Apr 27, 2021

What do you think about removing the publish step to DH?

Done
edit:markdown


WORKDIR /go/src/github.com/micromdm/micromdm/

ARG TARGETARCH
Copy link
Member

Choose a reason for hiding this comment

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

Do these have reasonable defaults or are they mandatory when doing a docker build?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are implicit default values for this already, which are overridden by the --platform flag in the buildx step.

Example Dockerfile:

FROM alpine
ARG TARGETPLATFORM
RUN echo "$TARGETPLATFORM"

Running this on an x86 machine running macOS:

docker build .
...
 => [2/2] RUN echo "linux/amd64"

vs

docker build --platform linux/arm .
...
=> [2/2] RUN echo "linux/arm/v7"
``

@jessepeterson jessepeterson merged commit 6e51f09 into micromdm:main Oct 11, 2021
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.

2 participants