Files

61 lines
2.4 KiB
Docker

# syntax=docker/dockerfile:1.2
FROM orogene:latest as oro
# 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-debian
RUN apt update && apt upgrade -y && \
apt install -y git openssh-client bash curl make wget sysvinit-utils && \
apt-get clean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
ARG ZOLAVERSION="0.20.0-1"
RUN wget https://github.com/barnumbirr/zola-debian/releases/download/v${ZOLAVERSION}/zola_${ZOLAVERSION}_amd64_bookworm.deb && \
dpkg -i zola_${ZOLAVERSION}_amd64_bookworm.deb && rm zola_${ZOLAVERSION}_amd64_bookworm.deb
#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
#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}
COPY --from=oro /oro /usr/local/bin/oro
RUN addgroup --gid 1000 ${LOCALGROUP} \
&& adduser --system --home=/home/swsuser --uid 1000 --gid 1000 ${LOCALUSER}
WORKDIR /home/swsuser
COPY --chown=swsuser:${LOCALGROUP} git2zola.sh /home/swsuser/
COPY --chown=swsuser:${LOCALGROUP} getOrCreateSshKeys.sh /home/swsuser/
RUN chmod 777 *.sh
USER swsuser
# The RSA SHA-1 hash algorithm is being quickly deprecated across operating systems
# https://www.openssh.com/txt/release-8.2
#RUN mkdir .ssh \
# && chmod 700 .ssh \
# && ssh-keygen -q -t ed25519 -C "swsuser@serinty.net" -f /home/swsuser/.ssh/id_ed25519 \
# && echo "use this public key for git repo auth:" \
# && cat /home/swsuser/.ssh/id_ed25519.pub
#RUN /home/swsuser/getOrCreateSshKeys.sh
RUN /usr/local/bin/oro --version
EXPOSE ${SWSPORT}
ENTRYPOINT ["/usr/bin/env"]
CMD ["/home/swsuser/git2zola.sh"]