Skip to content

Commit

Permalink
ci(github): 🐛 actually build multiarch in container
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed May 27, 2024
1 parent c11c11b commit 9142e23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ jobs:
platforms: ${{ matrix.platform }}
build-args: |
BUILD_ARCH=${{ matrix.platform }}
GO_VERSION=${GO_VERSION}
- name: Check and install cosign
uses: sigstore/[email protected]
with:
Expand Down
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT

ARG GO_VERSION=1.22

FROM docker.io/golang:${GO_VERSION} AS builder
WORKDIR /usr/src/go-hass-agent

# Default to an amd64 build
ARG BUILD_ARCH=amd64

FROM docker.io/golang:1.22 AS builder
WORKDIR /usr/src/go-hass-agent
# copy the src to the workdir
ADD . .
# install mage
RUN go install github.com/magefile/mage@latest
# install build dependencies
RUN mage -v -d build/magefiles -w . preps:deps amd64
RUN mage -v -d build/magefiles -w . preps:deps ${BUILD_ARCH}
# build the binary
RUN mage -v -d build/magefiles -w . build:full amd64
RUN mage -v -d build/magefiles -w . build:full ${BUILD_ARCH}

FROM ubuntu
# copy binary over from builder stage
COPY --from=builder /usr/src/go-hass-agent/dist/go-hass-agent-amd64 /usr/bin/go-hass-agent
COPY --from=builder /usr/src/go-hass-agent/dist/go-hass-agent-* /usr/bin/go-hass-agent
# reinstall minimum libraries for running
RUN mkdir /etc/dpkg/dpkg.conf.d
COPY <<EOF /etc/dpkg/dpkg.conf.d/excludes
Expand Down

0 comments on commit 9142e23

Please sign in to comment.