From e4a88a1fbdf0223022c845bd5f1b59fef9543571 Mon Sep 17 00:00:00 2001 From: admin2 Date: Tue, 22 Nov 2022 20:18:45 +0300 Subject: [PATCH] bash have to be installed to alpine linux --- Dockerfile | 5 ++++- build.sh | 1 + git2zola.sh | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 52a6888..7e1b3c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ # syntax=docker/dockerfile:1.2 # staic webserver with zola # https://github.com/joseluisq/static-web-server +# https://github.com/static-web-server/static-web-server +# https://gitlab.alpinelinux.org/alpine/docker-abuild/-/blob/master/entrypoint.sh FROM joseluisq/static-web-server:2-alpine AS sws4zola MAINTAINER serinty.net RUN apk upgrade --update-cache --available -RUN apk add --no-cache git openssh-client openssh-keygen +RUN apk add --no-cache git openssh-client openssh-keygen bash RUN apk add --no-cache zola --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ ARG GITPROJECTNAME=serinty-website ENV GITPROJECTNAME=${GITPROJECTNAME} @@ -46,6 +48,7 @@ RUN addgroup -g 1000 ${LOCALGROUP} \ && adduser --system --uid 1000 --ingroup ${LOCALGROUP} swsuser COPY ./git2zola.sh /home/swsuser/git2zola.sh RUN chown swsuser:${LOCALGROUP} /home/swsuser/git2zola.sh +ENTRYPOINT ["/usr/bin/env"] USER swsuser WORKDIR /home/swsuser RUN chmod +x /home/swsuser/git2zola.sh diff --git a/build.sh b/build.sh index 83cbdb4..c796101 100755 --- a/build.sh +++ b/build.sh @@ -5,4 +5,5 @@ export DOCKER_BUILDKIT=1 # docker secret create gogsserintywebsitepw - #read -p "enter git user:" GITUSER #read -s -p "enter git password:" GITPASSWD +#docker build --no-cache --progress=plain --tag sws4zola:latest . docker build --progress=plain --tag sws4zola:latest . diff --git a/git2zola.sh b/git2zola.sh index cebfde5..0b3ff65 100755 --- a/git2zola.sh +++ b/git2zola.sh @@ -14,6 +14,7 @@ GITSERVER=gogs.serinty.net GITSERVERPORT=22104 GITUSER=gogs GITPASSWD=gogspw +SERVICEENAME="static-web-server" if [ -z $IDLE_TIME ] @@ -22,10 +23,19 @@ if [ -z $IDLE_TIME ] IDLE_TIME=86400 fi +if [ -z ${SWSPORT} ] +then + # port over 1024 for normal user + SWSPORT=8970 +fi + trap "exit" EXIT +startSWSifNotRunning() + while true do + git status --porcelain gitstatus=$? echo ${gitstatus} @@ -46,5 +56,10 @@ do done func startSWSifNotRunning () { +#static-web-server is /usr/local/bin/static-web-server and in path + if pgrep -x "$SERVICENAME" >/dev/null + then + static-web-server --port ${SWSPORT} --log-level warn --root ~/public & + fi }