mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
chore: set vars for platform in dockerfile (#1399)
This commit is contained in:
parent
5d3d957756
commit
c71a30de76
@ -2,16 +2,26 @@ ARG GO_VERSION=1.15.8
|
||||
ARG NODE_VERSION=15.8.0
|
||||
ARG ENV=prod
|
||||
|
||||
#######################
|
||||
## These steps set platform / arch type specific variables
|
||||
#######################
|
||||
FROM alpine AS arm64-base
|
||||
ENV PROTOC_ARCH aarch_64
|
||||
|
||||
FROM alpine AS amd64-base
|
||||
ENV PROTOC_ARCH x86_64
|
||||
|
||||
#######################
|
||||
## This step sets up the folder structure,
|
||||
## initalices go mods,
|
||||
## downloads the protofiles,
|
||||
## downloads the protofiles,
|
||||
## protoc and protoc-gen-grpc-web for later use
|
||||
#######################
|
||||
FROM alpine AS base
|
||||
FROM ${BUILDARCH}-base AS base
|
||||
ARG PROTOC_VERSION=3.14.0
|
||||
ARG PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-x86_64.zip
|
||||
ARG PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip
|
||||
ARG GRPC_WEB_VERSION=1.2.1
|
||||
# no arm specific version available and x86 works fine at the moment:
|
||||
ARG GRPC_WEB=protoc-gen-grpc-web-${GRPC_WEB_VERSION}-linux-x86_64
|
||||
|
||||
|
||||
@ -133,13 +143,14 @@ 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
|
||||
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
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${BUILDARCH} go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o zitadel-linux-${BUILDARCH} cmd/zitadel/main.go
|
||||
|
||||
|
||||
#######################
|
||||
@ -153,9 +164,10 @@ RUN go get github.com/go-delve/delve/cmd/dlv
|
||||
## Final Production Image
|
||||
#######################
|
||||
FROM alpine:latest as artifact
|
||||
ARG BUILDARCH
|
||||
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
|
||||
COPY --from=prod-go-build /go/src/github.com/caos/zitadel/zitadel-linux-${BUILDARCH} /app/zitadel
|
||||
RUN chmod a+x /app/zitadel
|
||||
RUN ls -la /
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user