1
0
Fork 0
mirror of https://github.com/Luzifer/nginx-sso.git synced 2024-12-20 04:41:17 +00:00
nginx-sso/Dockerfile
Knut Ahlers ad7c1dd693
Move Docker image to use non-root user
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2023-07-29 13:44:05 +02:00

39 lines
1,008 B
Docker

FROM golang:alpine as builder
ADD . /go/src/github.com/Luzifer/nginx-sso
WORKDIR /go/src/github.com/Luzifer/nginx-sso
ENV CGO_ENABLED=0
RUN set -ex \
&& apk add --no-cache \
git \
&& go install \
-ldflags "-X main.version=$(git describe --tags || git rev-parse --short HEAD || echo dev)" \
-mod=readonly
FROM alpine
LABEL maintainer "Knut Ahlers <knut@ahlers.me>"
RUN set -ex \
&& apk --no-cache add \
bash \
ca-certificates \
dumb-init
COPY --from=builder /go/bin/nginx-sso /usr/local/bin/
COPY --from=builder /go/src/github.com/Luzifer/nginx-sso/config.yaml /usr/local/share/nginx-sso/
COPY --from=builder /go/src/github.com/Luzifer/nginx-sso/docker-start.sh /usr/local/bin/
COPY --from=builder /go/src/github.com/Luzifer/nginx-sso/frontend/* /usr/local/share/nginx-sso/frontend/
EXPOSE 8082
VOLUME ["/data"]
USER 1000:1000
ENTRYPOINT ["/usr/local/bin/docker-start.sh"]
CMD ["--"]
# vim: set ft=Dockerfile: