feat: add multiplatform docker image build (#18)

The build is very slow for some reason. ~15mins
This commit is contained in:
Alexis Couvreur
2021-10-01 23:19:33 +02:00
committed by GitHub
parent 29b1da52ea
commit a127a0fc86
2 changed files with 9 additions and 5 deletions

View File

@@ -33,13 +33,15 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
buildkitd-flags: --debug
-
name: Login to ghcr.io
uses: docker/login-action@v1
@@ -61,6 +63,5 @@ jobs:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64,linux/arm/v7
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -1,11 +1,14 @@
FROM golang:1.17-alpine AS build
ENV CGO_ENABLED=0
ENV PORT 10000
COPY . /go/src/ondemand-service
WORKDIR /go/src/ondemand-service
RUN go build -o /go/bin/ondemand-service
ARG TARGETOS
ARG TARGETARCH
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /go/bin/ondemand-service
FROM alpine
EXPOSE 10000