mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-26 22:38:45 +00:00
chore(ci): release pipeline for v2 (#3197)
* not working * test ci * correct path * test * test * test * remove k8s & test * test * test image * typo * test * fix * test * fix * test * fix * fix windows * fix * fix * fix codecov * fix with arch * test * test * test * test * trial * trial * trial * trial * trial * trial * trial * try * try * first improvement * trial * improve * improve * improve * use bash * trial * random test * wip * test with goreleaser and semrel * fix typo * trial * add buildx * define default * force buildkit * use buildx * debug GH docker * use images * debug docker * work around image name issues * trial * test * test with prebuilt image * fix * use load * test * use only docker * trial * test * use load * test * test with docker driver * trial * trial * trial * use arm * upload artifacts * try to cache grpc base * try to use a cache * fall back * test * fix * improve * upload artifacts * fix * name things * add tag if poc * args for protos * remove v2 build Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
co-authored by
Livio Amstutz
parent
2d208dd8ba
commit
2f3a482ade
@@ -1,44 +1,5 @@
|
||||
ARG GO_VERSION=1.17
|
||||
|
||||
#######################
|
||||
## These steps set platform / arch type specific variables
|
||||
#######################
|
||||
FROM alpine:3 AS arm64-base
|
||||
ENV PROTOC_ARCH aarch_64
|
||||
|
||||
FROM alpine:3 AS amd64-base
|
||||
ENV PROTOC_ARCH x86_64
|
||||
|
||||
#######################
|
||||
## This step sets up the folder structure,
|
||||
## initalices go mods,
|
||||
## downloads the protofiles and protoc for later use
|
||||
#######################
|
||||
FROM ${BUILDARCH}-base AS base
|
||||
ARG PROTOC_VERSION=3.18.0
|
||||
ARG PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip
|
||||
ARG GATEWAY_VERSION=2.6.0
|
||||
ARG VALIDATOR_VERSION=0.6.2
|
||||
|
||||
RUN apk add tar curl
|
||||
WORKDIR /proto
|
||||
|
||||
#protoc
|
||||
RUN apk add tar curl \
|
||||
&& curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/$PROTOC_ZIP \
|
||||
&& unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \
|
||||
&& unzip -o $PROTOC_ZIP -d /proto include/* \
|
||||
&& rm -f $PROTOC_ZIP \
|
||||
&& curl https://raw.githubusercontent.com/envoyproxy/protoc-gen-validate/v${VALIDATOR_VERSION}/validate/validate.proto --create-dirs -o include/validate/validate.proto \
|
||||
&& curl https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/v${GATEWAY_VERSION}/protoc-gen-openapiv2/options/annotations.proto --create-dirs -o include/protoc-gen-openapiv2/options/annotations.proto \
|
||||
&& curl https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/v${GATEWAY_VERSION}/protoc-gen-openapiv2/options/openapiv2.proto --create-dirs -o include/protoc-gen-openapiv2/options/openapiv2.proto \
|
||||
&& curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/annotations.proto --create-dirs -o include/google/api/annotations.proto \
|
||||
&& curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/http.proto --create-dirs -o include/google/api/http.proto \
|
||||
&& curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/field_behavior.proto --create-dirs -o include/google/api/field_behavior.proto
|
||||
|
||||
#zitadel protos
|
||||
COPY proto/ include/.
|
||||
|
||||
#######################
|
||||
## Go dependencies
|
||||
## Speed up this step by mounting your local go mod pkg directory
|
||||
@@ -48,7 +9,7 @@ RUN mkdir -p src/github.com/caos/zitadel
|
||||
WORKDIR /go/src/github.com/caos/zitadel
|
||||
|
||||
#download modules
|
||||
COPY ./go.* .
|
||||
COPY . .
|
||||
RUN go mod download
|
||||
|
||||
# install tools
|
||||
@@ -84,8 +45,8 @@ RUN go generate internal/ui/login/statik/generate.go \
|
||||
## generates grpc stub
|
||||
#######################
|
||||
FROM go-static AS go-stub
|
||||
COPY --from=base /proto /proto
|
||||
COPY --from=base /usr/local/bin /usr/local/bin/.
|
||||
COPY --from=zitadel-base:local /proto /proto
|
||||
COPY --from=zitadel-base:local /usr/local/bin /usr/local/bin/.
|
||||
|
||||
COPY build/zitadel/generate-grpc.sh build/zitadel/generate-grpc.sh
|
||||
COPY internal/protoc internal/protoc
|
||||
@@ -140,25 +101,3 @@ RUN go install github.com/rakyll/statik \
|
||||
#######################
|
||||
FROM scratch as go-codecov
|
||||
COPY --from=go-test /go/src/github.com/caos/zitadel/profile.cov profile.cov
|
||||
|
||||
#######################
|
||||
## Go prod build
|
||||
#######################
|
||||
FROM go-test as prod-go-build
|
||||
ARG BUILDARCH
|
||||
ARG VERSION=""
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${BUILDARCH} go build -a -installsuffix cgo -ldflags "-X main.version=${VERSION:-'dev'} -extldflags \"-static\"" -o zitadel-linux-${BUILDARCH} main.go
|
||||
|
||||
#######################
|
||||
## Go dev build
|
||||
#######################
|
||||
FROM go-base as dev-go-build
|
||||
ENTRYPOINT [ "go", "run", "main.go" ]
|
||||
|
||||
#######################
|
||||
## Only Copy Assets
|
||||
#######################
|
||||
FROM scratch as prod-go-export
|
||||
ARG BUILDARCH
|
||||
COPY --from=prod-go-build /go/src/github.com/caos/zitadel/zitadel-linux-${BUILDARCH} .
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#! /bin/sh
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
|
||||
Reference in New Issue
Block a user