2024-04-12 16:41:11 +02:00
|
|
|
FROM reg.cadoles.com/proxy_cache/library/golang:1.22.0 AS BUILD
|
2023-04-24 20:52:12 +02:00
|
|
|
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y make
|
|
|
|
|
2023-07-01 19:38:16 +02:00
|
|
|
ARG YQ_VERSION=4.34.1
|
|
|
|
|
|
|
|
RUN mkdir -p /usr/local/bin \
|
|
|
|
&& wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_amd64 \
|
|
|
|
&& chmod +x /usr/local/bin/yq
|
|
|
|
|
2023-04-24 20:52:12 +02:00
|
|
|
WORKDIR /src
|
|
|
|
|
2024-03-26 17:28:38 +01:00
|
|
|
COPY go.mod .
|
|
|
|
COPY go.sum .
|
|
|
|
|
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
COPY . /src
|
|
|
|
|
2023-04-24 20:52:12 +02:00
|
|
|
RUN make GORELEASER_ARGS='build --rm-dist --single-target --snapshot' goreleaser
|
|
|
|
|
2023-07-01 19:38:16 +02:00
|
|
|
# Patch config
|
|
|
|
RUN /src/dist/bouncer_linux_amd64_v1/bouncer -c '' config dump > /src/dist/bouncer_linux_amd64_v1/config.yml \
|
2024-06-26 14:36:28 +02:00
|
|
|
&& yq -i '.proxy.templates.dir = "/usr/share/bouncer/templates"' /src/dist/bouncer_linux_amd64_v1/config.yml \
|
2023-07-01 19:38:16 +02:00
|
|
|
&& yq -i '.layers.queue.templateDir = "/usr/share/bouncer/layers/queue/templates"' /src/dist/bouncer_linux_amd64_v1/config.yml \
|
2024-05-17 17:29:26 +02:00
|
|
|
&& yq -i '.layers.authn.templateDir = "/usr/share/bouncer/layers/authn/templates"' /src/dist/bouncer_linux_amd64_v1/config.yml \
|
2023-07-01 19:38:16 +02:00
|
|
|
&& yq -i '.admin.auth.privateKey = "/etc/bouncer/admin-key.json"' /src/dist/bouncer_linux_amd64_v1/config.yml \
|
2024-03-27 09:19:08 +01:00
|
|
|
&& yq -i '.redis.adresses = ["redis:6379"]' /src/dist/bouncer_linux_amd64_v1/config.yml \
|
|
|
|
&& yq -i '.redis.writeTimeout = "30s"' /src/dist/bouncer_linux_amd64_v1/config.yml \
|
|
|
|
&& yq -i '.redis.readTimeout = "30s"' /src/dist/bouncer_linux_amd64_v1/config.yml \
|
2024-05-24 14:52:31 +02:00
|
|
|
&& yq -i '.redis.dialTimeout = "30s"' /src/dist/bouncer_linux_amd64_v1/config.yml \
|
|
|
|
&& yq -i '.bootstrap.lockTimeout = "30s"' /src/dist/bouncer_linux_amd64_v1/config.yml \
|
|
|
|
&& yq -i '.integrations.kubernetes.lockTimeout = "30s"' /src/dist/bouncer_linux_amd64_v1/config.yml
|
2023-07-01 19:38:16 +02:00
|
|
|
|
2024-02-05 11:04:28 +01:00
|
|
|
FROM reg.cadoles.com/proxy_cache/library/alpine:3.19.1 AS RUNTIME
|
2023-04-24 20:52:12 +02:00
|
|
|
|
2024-02-05 11:04:28 +01:00
|
|
|
RUN apk add --no-cache ca-certificates dumb-init
|
2023-04-24 20:52:12 +02:00
|
|
|
|
2024-02-05 11:04:28 +01:00
|
|
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
2023-04-24 20:52:12 +02:00
|
|
|
|
2023-06-30 04:13:56 +02:00
|
|
|
RUN mkdir -p /usr/local/bin /usr/share/bouncer/bin /etc/bouncer
|
|
|
|
|
|
|
|
COPY --from=BUILD /src/dist/bouncer_linux_amd64_v1/bouncer /usr/share/bouncer/bin/bouncer
|
2023-07-04 03:42:44 +02:00
|
|
|
COPY --from=BUILD /src/layers /usr/share/bouncer/layers
|
2024-06-26 15:00:23 +02:00
|
|
|
COPY --from=BUILD /src/templates /usr/share/bouncer/templates
|
2023-07-01 19:38:16 +02:00
|
|
|
COPY --from=BUILD /src/dist/bouncer_linux_amd64_v1/config.yml /etc/bouncer/config.yml
|
2023-06-30 04:13:56 +02:00
|
|
|
|
2023-07-01 19:38:16 +02:00
|
|
|
RUN ln -s /usr/share/bouncer/bin/bouncer /usr/local/bin/bouncer
|
2023-04-24 20:52:12 +02:00
|
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
EXPOSE 8081
|
2024-05-24 14:52:31 +02:00
|
|
|
EXPOSE 8082
|
2023-04-24 20:52:12 +02:00
|
|
|
|
2024-05-29 14:18:40 +02:00
|
|
|
RUN adduser -D -s /bin/sh bouncer
|
2024-03-27 09:19:08 +01:00
|
|
|
|
2023-06-30 04:13:56 +02:00
|
|
|
ENV BOUNCER_CONFIG=/etc/bouncer/config.yml
|
2023-04-24 20:52:12 +02:00
|
|
|
|
2024-03-27 09:19:08 +01:00
|
|
|
USER bouncer
|
|
|
|
|
2024-05-29 14:18:40 +02:00
|
|
|
WORKDIR /home/bouncer
|
|
|
|
|
2023-06-30 04:13:56 +02:00
|
|
|
CMD ["bouncer"]
|