root: fix missing go client in dockerfile

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-07-11 12:44:26 +02:00
parent 02f87032cc
commit 406bbdcfc9
1 changed files with 21 additions and 5 deletions

View File

@ -11,7 +11,7 @@ RUN pip install pipenv && \
pipenv lock -r --dev-only > requirements-dev.txt pipenv lock -r --dev-only > requirements-dev.txt
# Stage 2: Build web API # Stage 2: Build web API
FROM openapitools/openapi-generator-cli as api-builder FROM openapitools/openapi-generator-cli as web-api-builder
COPY ./schema.yml /local/schema.yml COPY ./schema.yml /local/schema.yml
@ -21,16 +21,31 @@ RUN docker-entrypoint.sh generate \
-o /local/web/api \ -o /local/web/api \
--additional-properties=typescriptThreePlus=true,supportsES6=true,npmName=authentik-api,npmVersion=1.0.0 --additional-properties=typescriptThreePlus=true,supportsES6=true,npmName=authentik-api,npmVersion=1.0.0
# Stage 3: Build webui # Stage 3: Generate API Client
FROM openapitools/openapi-generator-cli as go-api-builder
COPY ./schema.yml /local/schema.yml
RUN docker-entrypoint.sh generate \
--git-host goauthentik.io \
--git-repo-id outpost \
--git-user-id api \
-i /local/schema.yml \
-g go \
-o /local/api \
--additional-properties=packageName=api,enumClassPrefix=true,useOneOfDiscriminatorLookup=true && \
rm -f /local/api/go.mod /local/api/go.sum
# Stage 4: Build webui
FROM node as npm-builder FROM node as npm-builder
COPY ./web /static/ COPY ./web /static/
COPY --from=api-builder /local/web/api /static/api COPY --from=web-api-builder /local/web/api /static/api
ENV NODE_ENV=production ENV NODE_ENV=production
RUN cd /static && npm i && npm run build RUN cd /static && npm i && npm run build
# Stage 4: Build go proxy # Stage 5: Build go proxy
FROM golang:1.16.5 AS builder FROM golang:1.16.5 AS builder
WORKDIR /work WORKDIR /work
@ -40,6 +55,7 @@ COPY --from=npm-builder /static/security.txt /work/web/security.txt
COPY --from=npm-builder /static/dist/ /work/web/dist/ COPY --from=npm-builder /static/dist/ /work/web/dist/
COPY --from=npm-builder /static/authentik/ /work/web/authentik/ COPY --from=npm-builder /static/authentik/ /work/web/authentik/
COPY --from=go-api-builder /local/api api
COPY ./cmd /work/cmd COPY ./cmd /work/cmd
COPY ./web/static.go /work/web/static.go COPY ./web/static.go /work/web/static.go
COPY ./internal /work/internal COPY ./internal /work/internal
@ -48,7 +64,7 @@ COPY ./go.sum /work/go.sum
RUN go build -o /work/authentik ./cmd/server/main.go RUN go build -o /work/authentik ./cmd/server/main.go
# Stage 5: Run # Stage 6: Run
FROM python:3.9-slim-buster FROM python:3.9-slim-buster
WORKDIR / WORKDIR /