From 406bbdcfc986475f0653ea56bd5590f8533650d1 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 11 Jul 2021 12:44:26 +0200 Subject: [PATCH] root: fix missing go client in dockerfile Signed-off-by: Jens Langhammer --- Dockerfile | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index b07ffc8a5..9ca24ff17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN pip install pipenv && \ pipenv lock -r --dev-only > requirements-dev.txt # 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 @@ -21,16 +21,31 @@ RUN docker-entrypoint.sh generate \ -o /local/web/api \ --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 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 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 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/authentik/ /work/web/authentik/ +COPY --from=go-api-builder /local/api api COPY ./cmd /work/cmd COPY ./web/static.go /work/web/static.go COPY ./internal /work/internal @@ -48,7 +64,7 @@ COPY ./go.sum /work/go.sum RUN go build -o /work/authentik ./cmd/server/main.go -# Stage 5: Run +# Stage 6: Run FROM python:3.9-slim-buster WORKDIR /