mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-11 18:44:22 +00:00
chore: speed up build (#4017)
* better cache dependencies * ignore local statik.go * remove previously generated statik.go file * remove redundant .dockerignore
This commit is contained in:
parent
ccde49b323
commit
6bb3220186
@ -9,6 +9,8 @@ release:
|
||||
|
||||
before:
|
||||
hooks:
|
||||
# this file would invalidate go source caches
|
||||
- sh -c "rm openapi/statik/statik.go || true"
|
||||
- docker build -f build/grpc/Dockerfile -t zitadel-base:local .
|
||||
- docker build -f build/zitadel/Dockerfile . -t zitadel-go-test --target go-codecov -o .artifacts/codecov
|
||||
- docker build -f build/zitadel/Dockerfile . -t zitadel-go-base --target go-copy -o .artifacts/grpc/go-client
|
||||
|
@ -3,10 +3,16 @@ ARG NODE_VERSION=16
|
||||
#######################
|
||||
## With this step we prepare all node_modules, this helps caching the build
|
||||
## Speed up this step by mounting your local node_modules directory
|
||||
## We also copy and generate the source code
|
||||
#######################
|
||||
FROM node:${NODE_VERSION} as npm-base
|
||||
WORKDIR /console
|
||||
|
||||
# Dependencies
|
||||
COPY console/package.json console/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Sources
|
||||
COPY console .
|
||||
COPY --from=zitadel-base:local /proto /proto
|
||||
COPY --from=zitadel-base:local /usr/local/bin /usr/local/bin/.
|
||||
@ -24,12 +30,8 @@ COPY --from=npm-base /console/src/app/proto/generated /console/src/app/proto/gen
|
||||
#######################
|
||||
FROM npm-base as angular-build
|
||||
|
||||
COPY console/package.json console/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
RUN npm run lint
|
||||
RUN npm run prodbuild
|
||||
RUN ls -la /console/dist/console
|
||||
|
||||
#######################
|
||||
## Only Copy Assets
|
||||
|
@ -5,18 +5,17 @@ ARG GO_VERSION=1.17
|
||||
## Speed up this step by mounting your local go mod pkg directory
|
||||
#######################
|
||||
FROM golang:${GO_VERSION} as go-dep
|
||||
RUN mkdir -p src/github.com/zitadel/zitadel
|
||||
WORKDIR /go/src/github.com/zitadel/zitadel
|
||||
|
||||
#download modules
|
||||
COPY . .
|
||||
COPY go.mod ./
|
||||
COPY go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# install tools
|
||||
COPY tools ./tools
|
||||
RUN ./tools/install.sh
|
||||
|
||||
|
||||
#######################
|
||||
## generates static files
|
||||
#######################
|
||||
@ -47,17 +46,20 @@ 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
|
||||
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 . .
|
||||
COPY cmd cmd
|
||||
COPY internal internal
|
||||
COPY pkg pkg
|
||||
COPY openapi openapi
|
||||
|
||||
#######################
|
||||
## copy for local dev
|
||||
|
Loading…
Reference in New Issue
Block a user