mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-10 01:54:38 +00:00
ad25f35539
* feat(operator): add base for zitadel operator * fix(operator): changed pipeline to release operator * fix(operator): fmt with only one parameter * fix(operator): corrected workflow job name * fix(zitadelctl): added restore and backuplist command * fix(zitadelctl): scale for restore * chore(container): use scratch for deploy container * fix(zitadelctl): limit image to scratch * fix(migration): added migration scripts for newer version * fix(operator): changed handling of kubeconfig in operator logic * fix(operator): changed handling of secrets in operator logic * fix(operator): use new version of zitadel * fix(operator): added path for migrations * fix(operator): delete doublets of migration scripts * fix(operator): delete subpaths and integrate logic into init container * fix(operator): corrected path in dockerfile for local migrations * fix(operator): added migrations for cockroachdb-secure * fix(operator): delete logic for ambassador module * fix(operator): added read and write secret commands * fix(operator): correct and align operator pipeline with zitadel pipeline * fix(operator): correct yaml error in operator pipeline * fix(operator): correct action name in operator pipeline * fix(operator): correct case-sensitive filename in operator pipeline * fix(operator): upload artifacts from buildx output * fix(operator): corrected attribute spelling error * fix(operator): combined jobs for operator binary and image * fix(operator): added missing comma in operator pipeline * fix(operator): added codecov for operator image * fix(operator): added codecov for operator image * fix(testing): code changes for testing and several unit-tests (#1009) * fix(operator): usage of interface of kubernetes client for testing and several unit-tests * fix(operator): several unit-tests * fix(operator): several unit-tests * fix(operator): changed order for the operator logic * fix(operator): added version of zitadelctl from semantic release * fix(operator): corrected function call with version of zitadelctl * fix(operator): corrected function call with version of zitadelctl * fix(operator): add check output to operator release pipeline * fix(operator): set --short length everywhere to 12 * fix(operator): zitadel setup in job instead of exec with several unit tests * fix(operator): fixes to combine newest zitadel and testing branch * fix(operator): corrected path in Dockerfile * fix(operator): fixed unit-test that was ignored during changes * fix(operator): fixed unit-test that was ignored during changes * fix(operator): corrected Dockerfile to correctly use env variable * fix(operator): quickfix takeoff deployment * fix(operator): corrected the clusterrolename in the applied artifacts * fix: update secure migrations * fix(operator): migrations (#1057) * fix(operator): copied migrations from orbos repository * fix(operator): newest migrations * chore: use cockroach-secure * fix: rename migration * fix: remove insecure cockroach migrations Co-authored-by: Stefan Benz <stefan@caos.ch> * fix: finalize labels * fix(operator): cli logging concurrent and fixe deployment of operator during restore * fix: finalize labels and cli commands * fix: restore * chore: cockroachdb is always secure * chore: use orbos consistent-labels latest commit * test: make tests compatible with new labels * fix: default to sa token for start command * fix: use cockroachdb v12.02 * fix: don't delete flyway user * test: fix migration test * fix: use correct table qualifiers * fix: don't alter sequence ownership * fix: upgrade flyway * fix: change ownership of all dbs and tables to admin user * fix: change defaultdb user * fix: treat clientid status codes >= 400 as errors * fix: reconcile specified ZITADEL version, not binary version * fix: add ca-certs * fix: use latest orbos code * fix: use orbos with fixed race condition * fix: use latest ORBOS code * fix: use latest ORBOS code * fix: make migration and scaling around restoring work * fix(operator): move zitadel operator * chore(migrations): include owner change migration * feat(db): add code base for database operator * fix(db): change used image registry for database operator * fix(db): generated mock * fix(db): add accidentally ignored file * fix(db): add cockroachdb backup image to pipeline * fix(db): correct pipeline and image versions * fix(db): correct version of used orbos * fix(db): correct database import * fix(db): go mod tidy * fix(db): use new version for orbos * fix(migrations): include migrations into zitadelctl binary (#1211) * fix(db): use statik to integrate migrations into binary * fix(migrations): corrections unit tests and pipeline for integrated migrations into zitadelctl binary * fix(migrations): correction in dockerfile for pipeline build * fix(migrations): correction in dockerfile for pipeline build * fix(migrations): dockerfile changes for cache optimization * fix(database): correct used part-of label in database operator * fix(database): correct used selectable label in zitadel operator * fix(operator): correct lables for user secrets in zitadel operator * fix(operator): correct lables for service test in zitadel operator * fix: don't enable database features for user operations (#1227) * fix: don't enable database features for user operations * fix: omit database feature for connection info adapter * fix: use latest orbos version * fix: update ORBOS (#1240) Co-authored-by: Florian Forster <florian@caos.ch> Co-authored-by: Elio Bischof <eliobischof@gmail.com>
134 lines
5.8 KiB
Plaintext
134 lines
5.8 KiB
Plaintext
#######################
|
|
## By default we build the prod enviroment
|
|
ARG ENV=prod
|
|
|
|
#######################
|
|
## This step downloads the protofiles, protoc and protoc-gen-grpc-web for later use
|
|
#######################
|
|
FROM alpine as base
|
|
RUN apk add tar curl
|
|
WORKDIR /.tmp
|
|
RUN wget -O protoc https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protoc-3.13.0-linux-x86_64.zip \
|
|
&& unzip protoc \
|
|
&& wget -O bin/protoc-gen-grpc-web https://github.com/grpc/grpc-web/releases/download/1.2.0/protoc-gen-grpc-web-1.2.0-linux-x86_64 \
|
|
&& chmod +x bin/protoc-gen-grpc-web
|
|
RUN curl https://raw.githubusercontent.com/envoyproxy/protoc-gen-validate/v0.4.1/validate/validate.proto --create-dirs -o validate/validate.proto \
|
|
&& curl https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/v1.14.6/protoc-gen-swagger/options/annotations.proto --create-dirs -o protoc-gen-swagger/options/annotations.proto \
|
|
&& curl https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/v1.14.6/protoc-gen-swagger/options/openapiv2.proto --create-dirs -o protoc-gen-swagger/options/openapiv2.proto \
|
|
&& curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/annotations.proto --create-dirs -o google/api/annotations.proto \
|
|
&& curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/http.proto --create-dirs -o google/api/http.proto \
|
|
&& curl https://raw.githubusercontent.com/protocolbuffers/protobuf/master/src/google/protobuf/empty.proto --create-dirs -o google/protobuf/empty.proto \
|
|
&& curl https://raw.githubusercontent.com/protocolbuffers/protobuf/master/src/google/protobuf/timestamp.proto --create-dirs -o google/protobuf/timestamp.proto \
|
|
&& curl https://raw.githubusercontent.com/protocolbuffers/protobuf/master/src/google/protobuf/descriptor.proto --create-dirs -o google/protobuf/descriptor.proto \
|
|
&& curl https://raw.githubusercontent.com/protocolbuffers/protobuf/master/src/google/protobuf/duration.proto --create-dirs -o google/protobuf/duration.proto \
|
|
&& curl https://raw.githubusercontent.com/protocolbuffers/protobuf/master/src/google/protobuf/any.proto --create-dirs -o google/protobuf/any.proto \
|
|
&& curl https://raw.githubusercontent.com/protocolbuffers/protobuf/master/src/google/protobuf/struct.proto --create-dirs -o google/protobuf/struct.proto
|
|
|
|
COPY pkg/grpc/admin/proto/admin.proto admin/proto/admin.proto
|
|
COPY pkg/grpc/auth/proto/auth.proto auth/proto/auth.proto
|
|
COPY pkg/grpc/management/proto/management.proto management/proto/management.proto
|
|
COPY pkg/grpc/message/proto/message.proto message/proto/message.proto
|
|
COPY internal/protoc/protoc-gen-authoption/authoption/options.proto authoption/options.proto
|
|
|
|
#######################
|
|
## With this step we prepare all node_modules, this helps caching the build
|
|
## Speed up this step by mounting your local node_modules directory
|
|
#######################
|
|
FROM node:15 as npm-base
|
|
WORKDIR console
|
|
COPY console/package.json console/package-lock.json ./
|
|
RUN npm install \
|
|
&& mkdir .tmp
|
|
COPY console .
|
|
COPY --from=base /.tmp/bin /usr/local/bin/
|
|
COPY --from=base /.tmp .tmp/protos/
|
|
COPY build/console build/console/
|
|
RUN build/console/generate-grpc.sh
|
|
|
|
FROM scratch as npm-copy
|
|
COPY --from=npm-base /console/src/app/proto/generated .
|
|
|
|
## anular dev build
|
|
FROM npm-base as dev-angular-build
|
|
RUN npm install -g @angular/cli
|
|
|
|
## anular prod build
|
|
FROM npm-base as prod-angular-build
|
|
RUN npm run prodbuild
|
|
|
|
#######################
|
|
## Go base build
|
|
## Speed up this step by mounting your local go mod pkg directory
|
|
#######################
|
|
FROM golang:1.15 as go-base
|
|
WORKDIR src/github.com/caos/zitadel/
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY --from=base /.tmp .tmp/protos/
|
|
COPY --from=base /.tmp/bin /usr/local/bin/
|
|
COPY internal/protoc/protoc-base internal/protoc/protoc-base/
|
|
COPY internal/protoc/protoc-gen-authoption internal/protoc/protoc-gen-authoption/
|
|
|
|
RUN go install \
|
|
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
|
|
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
|
|
github.com/golang/protobuf/protoc-gen-go \
|
|
github.com/envoyproxy/protoc-gen-validate
|
|
|
|
RUN go get -u github.com/go-bindata/go-bindata/...
|
|
|
|
RUN go-bindata ./internal/protoc/protoc-gen-authoption/templates \
|
|
&& go install ./internal/protoc/protoc-gen-authoption
|
|
|
|
COPY build/zitadel build/zitadel/
|
|
RUN build/zitadel/generate-grpc.sh
|
|
|
|
FROM scratch as go-copy
|
|
COPY --from=go-base /go/src/github.com/caos/zitadel/pkg/ .
|
|
|
|
## Go test
|
|
FROM go-base as go-test
|
|
COPY . .
|
|
#Migrations for cockroach-secure
|
|
RUN go install github.com/rakyll/statik
|
|
RUN ./build/operator/prebuild.sh ./migrations
|
|
|
|
RUN go test -race -v -coverprofile=profile.cov $(go list ./... | grep -v /operator/)
|
|
|
|
## Go test
|
|
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
|
|
COPY --from=prod-angular-build console/dist/console console/dist/console/
|
|
RUN go get github.com/rakyll/statik \
|
|
&& ./build/console/generate-static.sh \
|
|
&& ./build/login/generate-static.sh \
|
|
&& ./build/notification/generate-static.sh \
|
|
&& ./build/zitadel/generate-static.sh
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o zitadel-linux-amd64 cmd/zitadel/main.go
|
|
|
|
## Go dev build
|
|
FROM go-base as dev-go-build
|
|
RUN go get github.com/go-delve/delve/cmd/dlv
|
|
|
|
#######################
|
|
## Final Production Image
|
|
#######################
|
|
FROM alpine:latest as artifact
|
|
RUN adduser -D zitadel
|
|
COPY cmd/zitadel/*.yaml /app/
|
|
COPY --from=prod-go-build /go/src/github.com/caos/zitadel/zitadel-linux-amd64 /app/zitadel
|
|
RUN chmod a+x /app/zitadel
|
|
RUN ls -la /
|
|
|
|
## Scratch Image
|
|
FROM scratch as final
|
|
COPY --from=artifact /etc/passwd /etc/passwd
|
|
COPY --from=artifact /etc/ssl/certs /etc/ssl/certs
|
|
COPY --from=artifact /app /
|
|
USER zitadel
|
|
HEALTHCHECK NONE
|
|
ENTRYPOINT ["/zitadel"]
|