From bd4ea3488c0e2572351abfdbd5d545d4824e62ee Mon Sep 17 00:00:00 2001 From: admin2 Date: Wed, 16 Nov 2022 10:13:27 +0300 Subject: [PATCH] still not working. TLS error with gogs --- Dockerfile | 42 ++++++++++++++++++++++++++++++++++-------- build.sh | 5 ++++- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 274aec7..21a04e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,38 @@ +# syntax=docker/dockerfile:1.2 # staic webserver with zola # https://github.com/joseluisq/static-web-server -FROM joseluisq/static-web-server:latest +FROM joseluisq/static-web-server:2-alpine MAINTAINER serinty.net -RUN apk add git -RUN apk add zola --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ -ARG GITCLONEURL=clone https://gogs.serinty.net/Serinty/serinty-website.git +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} +# 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 clone ${GITCLONEURL} -RUN cd serinty-website -RUN requirements.sh -RUN zola build --output-dir ./public +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 diff --git a/build.sh b/build.sh index 3a55672..320ff05 100755 --- a/build.sh +++ b/build.sh @@ -2,4 +2,7 @@ #ssh-add # info from https://medium.com/@tonistiigi/build-secrets-and-ssh-forwarding-in-docker-18-09-ae8161d066 export DOCKER_BUILDKIT=1 -docker build --progress=plain --ssh default . +# docker secret create gogsserintywebsitepw - +read -p "enter git user:" GITUSER +read -s -p "enter git password:" GITPASSWD +docker build --progress=plain --build-arg GITUSER=${GITUSER} --build-arg GITPASSWD=${GITPASSWD} .