Skip to content

Commit

Permalink
Merge pull request #666 from oldgiova/QA-613-multiplatform-build
Browse files Browse the repository at this point in the history
Multiplaform build
  • Loading branch information
oldgiova committed Aug 25, 2023
2 parents 85d1202 + 1786f00 commit 15a3c16
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
variables:
DOCKER_REPOSITORY: mendersoftware/deviceauth
MULTIPLATFORM_BUILD: "true"
MULTIPLATFORM_PLATFORMS: "linux/amd64,linux/arm64"

stages:
- test_prep
Expand Down Expand Up @@ -45,3 +47,18 @@ test:acceptance_tests:
for cover in $@; do
tail -n +2 $cover >> tests/coverage-acceptance.txt;
done
# excludes non multiplatform build job
build:docker:
rules:
- when: never

# excludes non multiplatform build job
publish:image:
rules:
- when: never

# excludes non multiplatform build job
publish:image:mender:
rules:
- when: never
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM golang:1.20.4-alpine3.16 as builder
FROM --platform=$BUILDPLATFORM golang:1.20.4-alpine3.16 as builder
ARG TARGETARCH
WORKDIR /go/src/github.com/mendersoftware/deviceauth
RUN mkdir -p /etc_extra
RUN echo "nobody:x:65534:" > /etc_extra/group
Expand All @@ -8,7 +9,7 @@ RUN mkdir -p /tmp_extra && chown nobody:nobody /tmp_extra
RUN chown -R nobody:nobody /etc_extra
RUN apk add --no-cache ca-certificates
COPY ./ .
RUN CGO_ENABLED=0 GOARCH=amd64 go build -o deviceauth .
RUN CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o deviceauth .

FROM scratch
EXPOSE 8080
Expand Down

0 comments on commit 15a3c16

Please sign in to comment.