bouncer/Dockerfile

49 lines
1.6 KiB
Docker
Raw Permalink Normal View History

2023-06-30 04:13:56 +02:00
FROM golang:1.20 AS BUILD
2023-04-24 20:52:12 +02:00
RUN apt-get update \
&& apt-get install -y make
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
COPY . /src
WORKDIR /src
RUN make GORELEASER_ARGS='build --rm-dist --single-target --snapshot' goreleaser
# Patch config
RUN /src/dist/bouncer_linux_amd64_v1/bouncer -c '' config dump > /src/dist/bouncer_linux_amd64_v1/config.yml \
&& yq -i '.layers.queue.templateDir = "/usr/share/bouncer/layers/queue/templates"' /src/dist/bouncer_linux_amd64_v1/config.yml \
&& yq -i '.admin.auth.privateKey = "/etc/bouncer/admin-key.json"' /src/dist/bouncer_linux_amd64_v1/config.yml \
&& yq -i '.redis.adresses = ["redis:6379"]' /src/dist/bouncer_linux_amd64_v1/config.yml
FROM alpine:3.18 AS RUNTIME
2023-04-24 20:52:12 +02:00
ARG DUMB_INIT_VERSION=1.2.5
RUN apk add --no-cache ca-certificates
2023-04-24 20:52:12 +02:00
RUN mkdir -p /usr/local/bin \
&& wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_x86_64 \
&& chmod +x /usr/local/bin/dumb-init
ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
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
COPY --from=BUILD /src/layers /usr/share/bouncer/
COPY --from=BUILD /src/dist/bouncer_linux_amd64_v1/config.yml /etc/bouncer/config.yml
2023-06-30 04:13:56 +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
2023-06-30 04:13:56 +02:00
ENV BOUNCER_CONFIG=/etc/bouncer/config.yml
2023-04-24 20:52:12 +02:00
2023-06-30 04:13:56 +02:00
CMD ["bouncer"]