From 9407bf6708d19371c82b4d960a3337982e01c39f Mon Sep 17 00:00:00 2001 From: ttionya Date: Sat, 2 Jul 2022 22:00:50 +0800 Subject: [PATCH] feat: extracting environment variables --- Dockerfile | 13 +++++++++---- scripts/entrypoint.sh | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7851369..20df9b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,13 +4,18 @@ LABEL "repository"="https://github.com/ttionya/vaultwarden-backup" \ "homepage"="https://github.com/ttionya/vaultwarden-backup" \ "maintainer"="ttionya " +ARG USER_NAME="backuptool" +ARG USER_ID="1100" + +ENV LOCALTIME_FILE="/tmp/localtime" + COPY scripts/*.sh /app/ RUN chmod +x /app/*.sh \ - && apk add --no-cache bash heirloom-mailx p7zip sqlite supercronic tzdata \ - && ln -sf /tmp/localtime /etc/localtime \ && mkdir -m 777 /bitwarden \ - && addgroup -g 1100 backuptool \ - && adduser -u 1100 -Ds /bin/sh -G backuptool backuptool + && apk add --no-cache bash heirloom-mailx p7zip sqlite supercronic tzdata \ + && ln -sf "${LOCALTIME_FILE}" /etc/localtime \ + && addgroup -g "${USER_ID}" "${USER_NAME}" \ + && adduser -u "${USER_ID}" -Ds /bin/sh -G "${USER_NAME}" "${USER_NAME}" ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 7aa4dad..b13ec3a 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -37,7 +37,7 @@ if [[ "$1" == "restore" ]]; then fi function configure_timezone() { - ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /tmp/localtime + ln -sf "/usr/share/zoneinfo/${TIMEZONE}" "${LOCALTIME_FILE}" } function configure_cron() {