mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 16:47:32 +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:
@@ -9,6 +9,8 @@ release:
|
|||||||
|
|
||||||
before:
|
before:
|
||||||
hooks:
|
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/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-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
|
- 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
|
## With this step we prepare all node_modules, this helps caching the build
|
||||||
## Speed up this step by mounting your local node_modules directory
|
## 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
|
FROM node:${NODE_VERSION} as npm-base
|
||||||
WORKDIR /console
|
WORKDIR /console
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
COPY console/package.json console/package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# Sources
|
||||||
COPY console .
|
COPY console .
|
||||||
COPY --from=zitadel-base:local /proto /proto
|
COPY --from=zitadel-base:local /proto /proto
|
||||||
COPY --from=zitadel-base:local /usr/local/bin /usr/local/bin/.
|
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
|
FROM npm-base as angular-build
|
||||||
|
|
||||||
COPY console/package.json console/package-lock.json ./
|
|
||||||
RUN npm ci
|
|
||||||
|
|
||||||
RUN npm run lint
|
RUN npm run lint
|
||||||
RUN npm run prodbuild
|
RUN npm run prodbuild
|
||||||
RUN ls -la /console/dist/console
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
## Only Copy Assets
|
## Only Copy Assets
|
||||||
|
@@ -5,18 +5,17 @@ ARG GO_VERSION=1.17
|
|||||||
## Speed up this step by mounting your local go mod pkg directory
|
## Speed up this step by mounting your local go mod pkg directory
|
||||||
#######################
|
#######################
|
||||||
FROM golang:${GO_VERSION} as go-dep
|
FROM golang:${GO_VERSION} as go-dep
|
||||||
RUN mkdir -p src/github.com/zitadel/zitadel
|
|
||||||
WORKDIR /go/src/github.com/zitadel/zitadel
|
WORKDIR /go/src/github.com/zitadel/zitadel
|
||||||
|
|
||||||
#download modules
|
#download modules
|
||||||
COPY . .
|
COPY go.mod ./
|
||||||
|
COPY go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
# install tools
|
# install tools
|
||||||
COPY tools ./tools
|
COPY tools ./tools
|
||||||
RUN ./tools/install.sh
|
RUN ./tools/install.sh
|
||||||
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
## generates static files
|
## generates static files
|
||||||
#######################
|
#######################
|
||||||
@@ -47,17 +46,20 @@ COPY internal/api/assets/generator internal/api/assets/generator
|
|||||||
COPY internal/config internal/config
|
COPY internal/config internal/config
|
||||||
COPY internal/errors internal/errors
|
COPY internal/errors internal/errors
|
||||||
|
|
||||||
RUN build/zitadel/generate-grpc.sh \
|
RUN build/zitadel/generate-grpc.sh && \
|
||||||
&& go generate openapi/statik/generate.go \
|
go generate openapi/statik/generate.go && \
|
||||||
&& mkdir -p docs/apis/assets/ \
|
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 run internal/api/assets/generator/asset_generator.go -directory=internal/api/assets/generator/ -assets=docs/apis/assets/assets.md
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
## Go base build
|
## Go base build
|
||||||
#######################
|
#######################
|
||||||
FROM go-stub as go-base
|
FROM go-stub as go-base
|
||||||
# copy remaining zitadel files
|
# copy remaining zitadel files
|
||||||
COPY . .
|
COPY cmd cmd
|
||||||
|
COPY internal internal
|
||||||
|
COPY pkg pkg
|
||||||
|
COPY openapi openapi
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
## copy for local dev
|
## copy for local dev
|
||||||
|
Reference in New Issue
Block a user