60 lines
2.4 KiB
Docker
60 lines
2.4 KiB
Docker
# syntax=docker/dockerfile:1.2
|
|
# staic webserver with zola
|
|
# https://github.com/joseluisq/static-web-server
|
|
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 zola --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/
|
|
ARG GITPROJECTNAME=serinty-website
|
|
ENV GITPROJECTNAME=${GITPROJECTNAME}
|
|
ARG GITPROJECTUSER=Serinty
|
|
ENV GITPROJECTUSER=${GITPROJECTUSER}
|
|
ARG GITSERVER=gogs.serinty.net
|
|
ENV GITSERVER=${GITSERVER}
|
|
ARG GITSERVERPORT=22104
|
|
ENV GITSERVERPORT=${GITSERVERPORT}
|
|
ARG GITUSER=gogs
|
|
ENV GITUSER=${GITUSER}
|
|
ARG GITPASSWD=gogspw
|
|
ENV GITPASSWD=${GITPASSWD}
|
|
ARG LOCALUSER=swsuser
|
|
ENV LOCALUSER=${LOCALUSER}
|
|
ARG LOCALGROUP=swsgroup
|
|
ENV LOCALGROUP=${LOCALGROUP}
|
|
ARG SWSPORT=8970
|
|
ENV SWSPORT=${SWSPORT}
|
|
# 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}"
|
|
#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
|
|
#RUN cat ~/.ssh/known_hosts
|
|
#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
|
|
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
|
|
USER swsuser
|
|
WORKDIR /home/swsuser
|
|
RUN pwd && ls -la
|
|
RUN chmod +x /home/swsuser/git2zola.sh
|
|
RUN mkdir public
|
|
RUN mkdir .ssh \
|
|
&& chmod 700 .ssh \
|
|
&& ssh-keygen -q -f /home/swsuser/.ssh/id_rsa
|
|
RUN cp /home/swsuser/.ssh/id_rsa.pub /home/swsuser/public/
|
|
EXPOSE ${SWSPORT}
|
|
ENTRYPOINT ["/home/swsuser/git2zola.sh"]
|