change with scipt daemon step1
This commit is contained in:
+18
-6
@@ -18,15 +18,19 @@ ARG GITUSER=gogs
|
||||
ENV GITUSER=${GITUSER}
|
||||
ARG GITPASSWD=gogspw
|
||||
ENV GITPASSWD=${GITPASSWD}
|
||||
ARG LOCALUSER=swsuser
|
||||
ENV LOCALUSER=${LOCALUSER}
|
||||
ARG LOCALGROUP=swsgroup
|
||||
ENV LOCALGROUP=${LOCALGROUP}
|
||||
# ssh forwarding dosen't work, no --secret option is working
|
||||
#ARG GITCLONEURL=ssh://gogs@${GITSERVER}:${GITSERVERPORT}/${GITPROJECTUSER}/${GITPROJECTNAME}.git
|
||||
# https://gogs.serinty.net/Serinty/serinty-website.git
|
||||
#RUN --mount=type=secret,id=gogsserintywebsitepw GITPASSWD=$(cat /run/secrets/gogsserintywebsitepw)\
|
||||
# && export GITPASSWD
|
||||
ARG GITCLONEURL=https://${GITUSER}:${GITPASSWD}@${GITSERVER}:${GITSERVERPORT}/${GITPROJECTUSER}/${GITPROJECTNAME}.git
|
||||
ENV GITCLONEURL=${GITCLONEURL}
|
||||
RUN git config --global http.sslverify "false"
|
||||
RUN git clone "${GITCLONEURL}"
|
||||
#ARG GITCLONEURL=https://${GITUSER}:${GITPASSWD}@${GITSERVER}:${GITSERVERPORT}/${GITPROJECTUSER}/${GITPROJECTNAME}.git
|
||||
#ENV GITCLONEURL=${GITCLONEURL}
|
||||
#RUN git config --global http.sslverify "false"
|
||||
#RUN git clone "${GITCLONEURL}"
|
||||
#RUN mkdir -p -m 0700 ~/.ssh && touch -m 600 ~/.ssh/known_hosts && ssh-keyscan -H -4 -t rsa -p ${GITSERVERPORT} ${GITSERVER} >> ~/.ssh/known_hosts
|
||||
#RUN echo "Host *" >> /etc/ssh/ssh_config
|
||||
#RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
|
||||
@@ -34,5 +38,13 @@ RUN git clone "${GITCLONEURL}"
|
||||
#RUN cat /etc/ssh/ssh_config
|
||||
#RUN --mount=type=ssh ssh-add -L
|
||||
#RUN --mount=type=ssh git clone -v ${GITCLONEURL}
|
||||
WORKDIR ./${GITPROJECTNAME}/
|
||||
RUN zola build --output-dir /public_html
|
||||
#WORKDIR ./${GITPROJECTNAME}/
|
||||
#RUN zola build --output-dir /public_html
|
||||
RUN groupadd -g 1000 swsgroup \
|
||||
&& useradd -r -u 1000 -g swsgroup ${LOCALUSER}
|
||||
COPY ./git2zola.sh /home/${LOCALUSER}/.bin/git2zola.sh
|
||||
USER ${LOCALUSER}
|
||||
WORKDIR /home/${LOCALUSER}
|
||||
RUN mkdir public && ssh-keyscan -q
|
||||
|
||||
ENTRYPONT ['/home/${LOCALUSER}/.bin/git2zola.sh']
|
||||
|
||||
+17
-1
@@ -5,6 +5,17 @@
|
||||
# - with https user login ( problrm with TLS error with own gogs
|
||||
# - with auth token (not implemented in gogs yet)
|
||||
|
||||
#default sws docker path
|
||||
OUTPUT_DIR='/public'
|
||||
BASE_URL='docker.local'
|
||||
GITPROJECTNAME=serinty-website
|
||||
GITPROJECTUSER=Serinty
|
||||
GITSERVER=gogs.serinty.net
|
||||
GITSERVERPORT=22104
|
||||
GITUSER=gogs
|
||||
GITPASSWD=gogspw
|
||||
|
||||
|
||||
if [ -z $IDLE_TIME ]
|
||||
then
|
||||
# one day
|
||||
@@ -23,7 +34,12 @@ do
|
||||
git clone ${GITCLONEURL}
|
||||
elif [ ${gitstatus} -eq 0 ]
|
||||
then
|
||||
git pull
|
||||
gitpull=$(git pull --dry-run --ff-only)
|
||||
if [ ! -z ${gitpull} ]
|
||||
then
|
||||
git pull --ff-only
|
||||
zola build --base-url $BASE_URL --output-dir $OUTPUT_DIR
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep ${IDLE_TIME}
|
||||
|
||||
Reference in New Issue
Block a user