From 539e6deca5d6592b174bc07339f5650f5895083a Mon Sep 17 00:00:00 2001 From: Jens L Date: Fri, 10 Sep 2021 18:18:11 +0200 Subject: [PATCH] root: use go api client from github (#1378) Signed-off-by: Jens Langhammer --- .github/workflows/ci-outpost.yml | 3 --- Dockerfile | 22 +++------------------- go.mod | 1 + go.sum | 3 +++ ldap.Dockerfile | 20 ++------------------ proxy.Dockerfile | 18 +----------------- 6 files changed, 10 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci-outpost.yml b/.github/workflows/ci-outpost.yml index 50c267184..6f3785794 100644 --- a/.github/workflows/ci-outpost.yml +++ b/.github/workflows/ci-outpost.yml @@ -18,9 +18,6 @@ jobs: - uses: actions/setup-go@v2 with: go-version: '^1.16.3' - - name: Generate API - run: | - make gen-outpost - name: Run linter run: | # Create folder structure for go embeds diff --git a/Dockerfile b/Dockerfile index 0be3547f9..9627e541d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,22 +18,7 @@ COPY ./website /static/ ENV NODE_ENV=production RUN cd /static && npm i && npm run build-docs-only -# 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 +# Stage 3: Build webui FROM node as web-builder COPY ./web /static/ @@ -41,7 +26,7 @@ COPY ./web /static/ ENV NODE_ENV=production RUN cd /static && npm i && npm run build -# Stage 5: Build go proxy +# Stage 4: Build go proxy FROM golang:1.17.1 AS builder WORKDIR /work @@ -52,7 +37,6 @@ COPY --from=web-builder /static/dist/ /work/web/dist/ COPY --from=web-builder /static/authentik/ /work/web/authentik/ COPY --from=website-builder /static/help/ /work/website/help/ -COPY --from=go-api-builder /local/api api COPY ./cmd /work/cmd COPY ./web/static.go /work/web/static.go COPY ./website/static.go /work/website/static.go @@ -62,7 +46,7 @@ COPY ./go.sum /work/go.sum RUN go build -o /work/authentik ./cmd/server/main.go -# Stage 6: Run +# Stage 5: Run FROM python:3.9-slim-buster WORKDIR / diff --git a/go.mod b/go.mod index 7c24dbe41..7ce5e1bc2 100644 --- a/go.mod +++ b/go.mod @@ -34,6 +34,7 @@ require ( github.com/recws-org/recws v1.3.1 github.com/sirupsen/logrus v1.8.1 go.mongodb.org/mongo-driver v1.5.2 // indirect + goauthentik.io/api v0.0.0-20210910154342-563d2e449d7f // indirect golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 diff --git a/go.sum b/go.sum index 9f6271892..9ee99936f 100644 --- a/go.sum +++ b/go.sum @@ -554,6 +554,8 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +goauthentik.io/api v0.0.0-20210910154342-563d2e449d7f h1:Euk9QzrDRptNqFGXRIa8n1qNdhorUWORplLZh8UDUGk= +goauthentik.io/api v0.0.0-20210910154342-563d2e449d7f/go.mod h1:SPObiI/v8m5cjhj+bGvzb4Nm1w5gmlil5zHQx10sfjE= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -649,6 +651,7 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 h1:D7nTwh4J0i+5mW4Zjzn5omvlr6YBcWywE6KOcatyNxY= golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/ldap.Dockerfile b/ldap.Dockerfile index 4ef101ca1..3ccd195ef 100644 --- a/ldap.Dockerfile +++ b/ldap.Dockerfile @@ -1,29 +1,13 @@ -# Stage 1: Generate API Client -FROM openapitools/openapi-generator-cli as 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 2: Build +# Stage 1: Build FROM golang:1.17.1 AS builder WORKDIR /go/src/goauthentik.io COPY . . -COPY --from=api-builder /local/api api RUN go build -o /go/ldap ./cmd/ldap -# Stage 3: Run +# Stage 2: Run FROM gcr.io/distroless/base-debian10:debug ARG GIT_BUILD_HASH diff --git a/proxy.Dockerfile b/proxy.Dockerfile index b7947f759..1fab63371 100644 --- a/proxy.Dockerfile +++ b/proxy.Dockerfile @@ -1,19 +1,4 @@ -# Stage 1: Generate API Client -FROM openapitools/openapi-generator-cli as 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 2: Build website +# Stage 1: Build website FROM node as web-builder COPY ./web /static/ @@ -31,7 +16,6 @@ COPY --from=web-builder /static/robots.txt /work/web/robots.txt COPY --from=web-builder /static/security.txt /work/web/security.txt COPY --from=web-builder /static/dist/ /work/web/dist/ COPY --from=web-builder /static/authentik/ /work/web/authentik/ -COPY --from=api-builder /local/api api RUN go build -o /go/proxy ./cmd/proxy