add multiplatform img support

This commit is contained in:
2024-09-21 23:39:10 +02:00
parent 3944a0b8ef
commit 708f07a7ef
4 changed files with 14 additions and 8 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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/

View File

@@ -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/