From 708f07a7ef44c8fe2a91b62514c137dfb92a14bc Mon Sep 17 00:00:00 2001 From: Vargha Csongor Date: Sat, 21 Sep 2024 23:39:10 +0200 Subject: [PATCH] add multiplatform img support --- .github/workflows/auth-service-cd.yml | 2 +- .github/workflows/backend-cd.yml | 2 +- auth-service/dockerfile | 9 ++++++--- backend/dockerfile | 9 ++++++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/auth-service-cd.yml b/.github/workflows/auth-service-cd.yml index 49a8038..d666c83 100644 --- a/.github/workflows/auth-service-cd.yml +++ b/.github/workflows/auth-service-cd.yml @@ -48,4 +48,4 @@ jobs: push: true context: "{{defaultContext}}:auth-service" tags: vcscsvcscs/gheritage-auth-service:${{steps.create_image_tag.outputs.result}} - platforms: linux/arm64 + platforms: linux/amd64, linux/arm64 diff --git a/.github/workflows/backend-cd.yml b/.github/workflows/backend-cd.yml index e2bfce7..5cb5d5d 100644 --- a/.github/workflows/backend-cd.yml +++ b/.github/workflows/backend-cd.yml @@ -48,4 +48,4 @@ jobs: push: true context: "{{defaultContext}}:backend" tags: vcscsvcscs/gheritage-backend-service:${{steps.create_image_tag.outputs.result}} - platforms: linux/arm64 + platforms: linux/amd64, linux/arm64 \ No newline at end of file diff --git a/auth-service/dockerfile b/auth-service/dockerfile index fffd278..fc71a2d 100644 --- a/auth-service/dockerfile +++ b/auth-service/dockerfile @@ -1,14 +1,17 @@ -FROM arm64v8/golang:1.22.2-alpine as build +FROM --platform=$BUILDPLATFORM golang:alpine AS build + +ARG TARGETOS +ARG TARGETARCH WORKDIR /app COPY . . -RUN GOOS=linux GOARCH=arm64 go build -o auth-service +RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o auth-service RUN apk update && apk add ca-certificates && update-ca-certificates -FROM arm64v8/busybox:1.36.1 +FROM --platform=$TARGETPLATFORM busybox:1.36.1 COPY --from=build /etc/ssl/certs /etc/ssl/certs COPY --from=build /app/auth-service /app/ diff --git a/backend/dockerfile b/backend/dockerfile index d1ff741..d3abdaf 100644 --- a/backend/dockerfile +++ b/backend/dockerfile @@ -1,14 +1,17 @@ -FROM arm64v8/golang:1.22.2-alpine as build +FROM --platform=$BUILDPLATFORM golang:alpine AS build + +ARG TARGETOS +ARG TARGETARCH WORKDIR /app COPY . . -RUN GOOS=linux GOARCH=arm64 go build -o backend +RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o backend RUN apk update && apk add ca-certificates && update-ca-certificates -FROM arm64v8/busybox:1.36.1 +FROM --platform=$TARGETPLATFORM busybox:1.36.1 COPY --from=build /etc/ssl/certs /etc/ssl/certs COPY --from=build /app/backend /app/