From 4fca15fa213b8a9b865621001bdc06c3c930a59c Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 29 Jul 2023 16:59:05 +0200 Subject: [PATCH] [#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 --- Dockerfile | 4 +++- docker-start.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7934653..4ee11da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,9 @@ RUN set -ex \ && apk --no-cache add \ bash \ ca-certificates \ - dumb-init + 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/ diff --git a/docker-start.sh b/docker-start.sh index 74cc9bf..0bcd68d 100755 --- a/docker-start.sh +++ b/docker-start.sh @@ -2,7 +2,7 @@ set -euo pipefail # Copy frontend if not available -[ -d /data/frontend/index.html ] || cp -r /usr/local/share/nginx-sso/frontend /data/ +[ -f /data/frontend/index.html ] || cp -r /usr/local/share/nginx-sso/frontend /data/ [ -e /data/config.yaml ] || { cp /usr/local/share/nginx-sso/config.yaml /data/config.yaml