bash have to be installed to alpine linux
This commit is contained in:
+4
-1
@@ -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
|
||||
|
||||
@@ -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 .
|
||||
|
||||
+15
@@ -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
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user