root: generate API Client in dockerfile instead of copying it (#942)
* root: generate API Client in dockerfile instead of copying it Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * outpost: fix docker build Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * root: fix path for docker build Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * outpost: set explicit buildContext Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
@ -99,11 +99,6 @@ stages:
|
||||
- task: GoTool@0
|
||||
inputs:
|
||||
version: '1.16.3'
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
buildType: 'current'
|
||||
artifactName: 'go_api_client'
|
||||
path: "outpost/api/"
|
||||
- task: Bash@3
|
||||
inputs:
|
||||
targetType: 'inline'
|
||||
@ -115,7 +110,7 @@ stages:
|
||||
repository: 'authentik/outpost-proxy'
|
||||
command: 'build'
|
||||
Dockerfile: 'outpost/proxy.Dockerfile'
|
||||
buildContext: 'outpost/'
|
||||
buildContext: '$(Build.SourcesDirectory)'
|
||||
tags: |
|
||||
gh-$(branchName)
|
||||
gh-$(Build.SourceVersion)
|
||||
@ -135,11 +130,6 @@ stages:
|
||||
- task: GoTool@0
|
||||
inputs:
|
||||
version: '1.16.3'
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
buildType: 'current'
|
||||
artifactName: 'go_api_client'
|
||||
path: "outpost/api/"
|
||||
- task: Bash@3
|
||||
inputs:
|
||||
targetType: 'inline'
|
||||
@ -151,7 +141,7 @@ stages:
|
||||
repository: 'authentik/outpost-ldap'
|
||||
command: 'build'
|
||||
Dockerfile: 'outpost/ldap.Dockerfile'
|
||||
buildContext: 'outpost/'
|
||||
buildContext: '$(Build.SourcesDirectory)'
|
||||
tags: |
|
||||
gh-$(branchName)
|
||||
gh-$(Build.SourceVersion)
|
||||
|
@ -1,15 +1,33 @@
|
||||
# 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/outpost/api \
|
||||
--additional-properties=packageName=api,enumClassPrefix=true,useOneOfDiscriminatorLookup=true && \
|
||||
rm -f /local/outpost/api/go.mod /local/outpost/api/go.sum
|
||||
|
||||
# Stage 2: Build
|
||||
FROM golang:1.16.4 AS builder
|
||||
ARG GIT_BUILD_HASH
|
||||
ENV GIT_BUILD_HASH=$GIT_BUILD_HASH
|
||||
|
||||
WORKDIR /work
|
||||
WORKDIR /go/src/goauthentik.io/outpost
|
||||
|
||||
COPY . .
|
||||
COPY ./outpost .
|
||||
COPY --from=api-builder /local/outpost/api api
|
||||
|
||||
RUN go build -o /work/ldap ./cmd/ldap
|
||||
RUN go build -o /go/ldap ./cmd/ldap
|
||||
|
||||
# Stage 3: Run
|
||||
FROM gcr.io/distroless/base-debian10:debug
|
||||
|
||||
COPY --from=builder /work/ldap /
|
||||
COPY --from=builder /go/ldap /
|
||||
|
||||
ENTRYPOINT ["/ldap"]
|
||||
|
@ -1,16 +1,34 @@
|
||||
# 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/outpost/api \
|
||||
--additional-properties=packageName=api,enumClassPrefix=true,useOneOfDiscriminatorLookup=true && \
|
||||
rm -f /local/outpost/api/go.mod /local/outpost/api/go.sum
|
||||
|
||||
# Stage 2: Build
|
||||
FROM golang:1.16.4 AS builder
|
||||
ARG GIT_BUILD_HASH
|
||||
ENV GIT_BUILD_HASH=$GIT_BUILD_HASH
|
||||
|
||||
WORKDIR /work
|
||||
WORKDIR /go/src/goauthentik.io/outpost
|
||||
|
||||
COPY . .
|
||||
COPY ./outpost .
|
||||
COPY --from=api-builder /local/outpost/api api
|
||||
|
||||
RUN go build -o /work/proxy ./cmd/proxy
|
||||
RUN go build -o /go/proxy ./cmd/proxy
|
||||
|
||||
# Stage 3: Run
|
||||
FROM gcr.io/distroless/base-debian10:debug
|
||||
|
||||
COPY --from=builder /work/proxy /
|
||||
COPY --from=builder /go/proxy /
|
||||
|
||||
HEALTHCHECK CMD [ "wget", "--spider", "http://localhost:4180/akprox/ping" ]
|
||||
|
||||
|
Reference in New Issue
Block a user