mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 21:27:22 +00:00

* beginning with postgres statements * try pgx * use pgx * database * init works for postgres * arrays working * init for cockroach * init * start tests * tests * TESTS * ch * ch * chore: use go 1.18 * read stmts * fix typo * tests * connection string * add missing error handler * cleanup * start all apis * go mod tidy * old update * switch back to minute * on conflict * replace string slice with `database.StringArray` in db models * fix tests and start * update go version in dockerfile * setup go * clean up * remove notification migration * update * docs: add deploy guide for postgres * fix: revert sonyflake * use `database.StringArray` for daos * use `database.StringArray` every where * new tables * index naming, metadata primary key, project grant role key type * docs(postgres): change to beta * chore: correct compose * fix(defaults): add empty postgres config * refactor: remove unused code * docs: add postgres to self hosted * fix broken link * so? * change title * add mdx to link * fix stmt * update goreleaser in test-code * docs: improve postgres example * update more projections * fix: add beta log for postgres * revert index name change * prerelease * fix: add sequence to v1 "reduce paniced" * log if nil * add logging * fix: log output * fix(import): check if org exists and user * refactor: imports * fix(user): ignore malformed events * refactor: method naming * fix: test * refactor: correct errors.Is call * ci: don't build dev binaries on main * fix(go releaser): update version to 1.11.0 * fix(user): projection should not break * fix(user): handle error properly * docs: correct config example * Update .releaserc.js * Update .releaserc.js Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: Elio Bischof <eliobischof@gmail.com>
107 lines
4.2 KiB
Docker
107 lines
4.2 KiB
Docker
ARG GO_VERSION=1.19
|
|
|
|
#######################
|
|
## Go dependencies
|
|
## Speed up this step by mounting your local go mod pkg directory
|
|
#######################
|
|
FROM golang:${GO_VERSION} as go-dep
|
|
WORKDIR /go/src/github.com/zitadel/zitadel
|
|
|
|
#download modules
|
|
COPY go.mod ./
|
|
COPY go.sum ./
|
|
RUN go mod download
|
|
|
|
# install tools
|
|
COPY tools ./tools
|
|
RUN ./tools/install.sh
|
|
|
|
#######################
|
|
## generates static files
|
|
#######################
|
|
FROM go-dep AS go-static
|
|
COPY internal/api/ui/login/static internal/api/ui/login/static
|
|
COPY internal/api/ui/login/statik internal/api/ui/login/statik
|
|
COPY internal/notification/static internal/notification/static
|
|
COPY internal/notification/statik internal/notification/statik
|
|
COPY internal/static internal/static
|
|
COPY internal/statik internal/statik
|
|
|
|
RUN go generate internal/api/ui/login/statik/generate.go \
|
|
&& go generate internal/api/ui/login/static/generate.go \
|
|
&& go generate internal/notification/statik/generate.go \
|
|
&& go generate internal/statik/generate.go
|
|
|
|
#######################
|
|
## generates grpc stub
|
|
#######################
|
|
FROM go-static AS go-stub
|
|
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
|
|
COPY openapi/statik openapi/statik
|
|
COPY internal/api/assets/generator internal/api/assets/generator
|
|
COPY internal/config internal/config
|
|
COPY internal/errors internal/errors
|
|
|
|
RUN build/zitadel/generate-grpc.sh && \
|
|
go generate openapi/statik/generate.go && \
|
|
mkdir -p docs/apis/assets/ && \
|
|
go run internal/api/assets/generator/asset_generator.go -directory=internal/api/assets/generator/ -assets=docs/apis/assets/assets.md
|
|
|
|
#######################
|
|
## Go base build
|
|
#######################
|
|
FROM go-stub as go-base
|
|
# copy remaining zitadel files
|
|
COPY cmd cmd
|
|
COPY internal internal
|
|
COPY pkg pkg
|
|
COPY openapi openapi
|
|
|
|
#######################
|
|
## copy for local dev
|
|
#######################
|
|
FROM scratch as go-copy
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/internal/api/ui/login/statik/statik.go internal/api/ui/login/statik/statik.go
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/internal/notification/statik/statik.go internal/notification/statik/statik.go
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/internal/statik/statik.go internal/statik/statik.go
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/openapi/statik/statik.go openapi/statik/statik.go
|
|
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/pkg/grpc pkg/grpc
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/openapi/v2/zitadel openapi/v2/zitadel
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/openapi/statik/statik.go openapi/statik/statik.go
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/internal/protoc/protoc-gen-authoption/templates.gen.go internal/protoc/protoc-gen-authoption/templates.gen.go
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/internal/protoc/protoc-gen-authoption/authoption/options.pb.go internal/protoc/protoc-gen-authoption/authoption/options.pb.go
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/docs/apis/proto docs/docs/apis/proto
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/docs/apis/assets docs/docs/apis/assets
|
|
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/internal/api/assets/authz.go ./internal/api/assets/authz.go
|
|
COPY --from=go-stub /go/src/github.com/zitadel/zitadel/internal/api/assets/router.go ./internal/api/assets/router.go
|
|
|
|
#######################
|
|
## Go test
|
|
#######################
|
|
FROM go-base as go-test
|
|
|
|
ARG COCKROACH_BINARY=cockroach
|
|
RUN apt install openssl tzdata tar
|
|
|
|
# cockroach binary used to backup database
|
|
RUN mkdir /usr/local/lib/cockroach
|
|
RUN wget -qO- https://binaries.cockroachdb.com/cockroach-v22.1.0.linux-amd64.tgz \
|
|
| tar xvz && cp -i cockroach-v22.1.0.linux-amd64/cockroach /usr/local/bin/
|
|
RUN rm -r cockroach-v22.1.0.linux-amd64
|
|
|
|
# Migrations for cockroach-secure
|
|
RUN go install github.com/rakyll/statik \
|
|
&& go test -race -v -coverprofile=profile.cov $(go list ./... | grep -v /operator/)
|
|
|
|
#######################
|
|
## Go test results
|
|
#######################
|
|
FROM scratch as go-codecov
|
|
COPY --from=go-test /go/src/github.com/zitadel/zitadel/profile.cov profile.cov
|