diff --git a/Dockerfile b/Dockerfile index a2b7d57..a1d06ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ LABEL maintainer="Deokgyu Yang " \ RUN apk update RUN apk add --no-cache \ - bash bash-completion supervisor tzdata shadow \ + bash bash-completion supervisor tzdata shadow git openssh-client \ php82 php82-fpm php82-session php82-json php82-xml php82-mbstring php82-exif \ php82-intl php82-gd php82-pecl-imagick php82-zip php82-opcache \ ffmpeg imagemagick zip apache2-utils patch @@ -16,6 +16,7 @@ ENV TZ='Europe/Berlin' ENV HTPASSWD='false' ENV HTPASSWD_USER='guest' ENV HTPASSWD_PW='' +ENV GIT_REPO="https://code.shork.eu/shork.eu/Branding.git" # Copy configuration files COPY config/h5ai.conf /etc/nginx/conf.d/h5ai.conf diff --git a/config/init.sh b/config/init.sh index e0fee27..12ef2a5 100644 --- a/config/init.sh +++ b/config/init.sh @@ -75,6 +75,26 @@ msg "Set permission for caching..." chmod -R 777 $conf_h5ai/public/cache chmod -R 777 $conf_h5ai/private/cache +# Clone external repository into /h5ai +if [ -n "$GIT_REPO" ]; then + msg "Git repository variable detected: $GIT_REPO" + workdir="/tmp/cloned" + rm -rf "$workdir" + mkdir -p "$workdir" + if git clone "$GIT_REPO" "$workdir"; then + msg "Repository cloned to $workdir" + mkdir -p /h5ai + find /h5ai -mindepth 1 -maxdepth 1 -exec rm -rf {} + 2>/dev/null || true + cp -a "$workdir"/. /h5ai/ + chown -R abc:abc /h5ai + msg "Copied cloned repository contents into /h5ai" + else + msg "Failed to clone $GIT_REPO" + fi +else + msg "No GIT_REPO provided; skipping clone step" +fi + # If an user wants to set htpasswd if [ "$HTPASSWD" = "true" ]; then if [ ! -f "$conf_htpwd" ]; then