51 lines
2.0 KiB
Docker
51 lines
2.0 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
|
|
MAINTAINER serinty.net
|
|
RUN apk upgrade --update-cache --available
|
|
RUN apk add --no-cache git openssh-client
|
|
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}
|
|
# 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 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']
|