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 4fca15fa21
[#79] Fix Docker image broken by user change
- Properly check file existence (`-f`, not `-d`)
- Create and chown the data directory in case no mount is present

closes #79

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2023-07-29 17:02:01 +02:00

41 lines
1 KiB
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 \
&& mkdir /data \
&& chown -R 1000:1000 /data
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: