diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..58a1b5a2 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,35 @@ +name: Publish Docker image +on: + release: + types: [published] +jobs: + push_to_registry: + name: Build and push Docker image + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Set up QEMU for multi-architecture builds + uses: docker/setup-qemu-action@c308fdd69d26ed66f4506ebd74b180abe5362145 #v1.1.0 + with: + image: tonistiigi/binfmt:latest + platforms: all + + - name: Check out this repo + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + with: + fetch-depth: 1 # Checkout only latest commit + + - name: Login to Github Packages Container registry with ephemeral token + run: docker login ghcr.io --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} + + - name: Create builder instance + run: docker buildx create --use + + - name: Build and push image + run: | + docker buildx build \ + --platform linux/amd64,linux/arm,linux/arm64 \ + --tag ghcr.io/micromdm/micromdm:latest \ + --tag ghcr.io/micromdm/micromdm:${{ github.event.release.tag_name }} \ + --push \ + . diff --git a/CHANGELOG.md b/CHANGELOG.md index a4c7bb48..fd986fba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## [Unreleased](https://github.com/micromdm/micromdm/compare/v1.8.0...main) TBD +- Add GHCR container workflow. Add ARM build. (#745) - New in-memory-only command queue (#736) - Bootstrap token support (#781, #782) - Fix potential DEP sync data loss (#779) diff --git a/Dockerfile b/Dockerfile index 42b4c503..d7270f14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,12 @@ FROM golang:latest as builder WORKDIR /go/src/github.com/micromdm/micromdm/ +ARG TARGETARCH +ARG TARGETOS + ENV CGO_ENABLED=0 \ - GOARCH=amd64 \ - GOOS=linux + GOARCH=$TARGETARCH \ + GOOS=$TARGETOS COPY . .