CHANGE: Multiarch deployment

This commit is contained in:
2025-02-21 20:43:54 +01:00
parent f2a5e9874d
commit 5fb6254c04
3 changed files with 19 additions and 19 deletions

View File

@@ -1,12 +1,21 @@
FROM golang:alpine # syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM golang:alpine AS build
ARG TARGETOS
ARG TARGETARCH
ENV CGO_ENABLED=0 \
GOOS=$TARGETOS \
GOARCH=$TARGETARCH
WORKDIR /app WORKDIR /app
COPY go.mod go.sum /app/ COPY go.mod go.sum /app/
RUN go mod download && go mod verify RUN go mod download && go mod verify
COPY . . COPY . .
RUN go build -o /usr/local/bin/app RUN go build -o server .
CMD ["app"] FROM alpine
WORKDIR /app
COPY --from=build /app/server /app/server
COPY /static /app/static
ENTRYPOINT ["./server"]

17
Jenkinsfile vendored
View File

@@ -16,22 +16,9 @@ pipeline {
} }
} }
steps { steps {
sh 'make build_backend' sh 'make backend'
}
}
stage('Deploying image arbeitszeit-backend') {
when {
anyOf{
changeset 'Jenkinsfile'
changeset 'Makefile'
changeset 'Backend/**'
}
}
steps {
sh 'make push_backend'
}
} }
} }
} }
}

View File

@@ -36,3 +36,7 @@ push_%:
full_%: full_%:
make build_$* make build_$*
make push_$* make push_$*
backend: login_registry
docker buildx build --platform linux/amd64,linux/arm64 -t git.letsstein.de/tom/arbeitszeit-backend:latest Backend --push
docker buildx build --platform linux/amd64,linux/arm64 -t git.letsstein.de/tom/arbeitszeit-backend:${GIT_COMMIT} Backend --push