From af92a65229513bea63993545e7083d0ac615fe92 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sun, 16 Jul 2023 22:27:57 +0100 Subject: [PATCH] Final changes before moving to cgit --- Dockerfile | 15 ++++++--------- Makefile | 5 ++++- root/etc/s6-overlay/s6-rc.d/svc-gitweb/run | 5 +++-- root/etc/tor/torrc | 10 +++++++--- root/usr/local/bin/run-tor.sh | 17 +++++++++++++++++ 5 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 root/usr/local/bin/run-tor.sh diff --git a/Dockerfile b/Dockerfile index c8546af..ed37ede 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,10 @@ -FROM scratch +FROM lscr.io/linuxserver/openssh-server:latest + +ENV USER_NAME=git +RUN apk add --no-cache --upgrade git lighttpd tor git-gitweb python3 -COPY --from=lscr.io/linuxserver/openssh-server:latest / / +COPY /root/ / -RUN apk add --no-cache --upgrade git lighthttpd tor \ - && mkdir -p /repo && cd /repo && git init . --bare \ - && mkdir -p /var/lib/tor/git \ - && mkdir -p /var/lib/tor/gitweb \ -COPY /root / -COPY -CMD ["tor", "--runasdaemon 0"] +CMD ["/bin/bash", "/usr/local/bin/run-tor.sh"]#["tor", "--runasdaemon", "0"] ENTRYPOINT ["/init"] diff --git a/Makefile b/Makefile index 550efba..0e93659 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,11 @@ -TAG=$(git describ) +TAG = $(shell git describe) build: docker build -t lxsameer/hephaestus:$(TAG) . +run: + docker run -d --name test -e PUID=1000 -e PGID=1000 -e TZ=Etc/UTC -e PUBLIC_KEY_DIR=$(PWD)/pub_keys/ -p 2222:22 -p 9000:9000 lxsameer/hephaestus:$(TAG) + push: docker push lxsameer/hephaestus:$(TAG) diff --git a/root/etc/s6-overlay/s6-rc.d/svc-gitweb/run b/root/etc/s6-overlay/s6-rc.d/svc-gitweb/run index 6cb6bf4..6e0c35b 100644 --- a/root/etc/s6-overlay/s6-rc.d/svc-gitweb/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-gitweb/run @@ -1,3 +1,4 @@ #!/command/execlineb -P -export GITWEB_PROJECTROOT=/repo -git-instaweb -b /bin/true -l +fdmove -c 2 1 +cd /repo +exec sudo -u git git instaweb -b /bin/true -p 9000 -d python diff --git a/root/etc/tor/torrc b/root/etc/tor/torrc index 9f668b2..353b5e1 100644 --- a/root/etc/tor/torrc +++ b/root/etc/tor/torrc @@ -1,7 +1,11 @@ +User git +PIDFile /tor/tor.pid +DataDirectory /tor/ + HiddenServiceDir /var/lib/tor/git/ HiddenServicePort 22 127.0.0.1:22 -HiddenServiceAuthorizeClient stealth git +HiddenServiceVersion 3 HiddenServiceDir /var/lib/tor/gitweb/ -HiddenServicePort 80 127.0.0.1:1234 -HiddenServiceAuthorizeClient stealth gitweb \ No newline at end of file +HiddenServicePort 80 127.0.0.1:9000 +HiddenServiceVersion 3 diff --git a/root/usr/local/bin/run-tor.sh b/root/usr/local/bin/run-tor.sh new file mode 100644 index 0000000..6da672a --- /dev/null +++ b/root/usr/local/bin/run-tor.sh @@ -0,0 +1,17 @@ +#! /bin/bash +echo "Fix perms" +mkdir -p /repo +cd /repo || exit 1 +chown git:git /repo +sudo -u git git init . --bare +mkdir -p /var/lib/tor/git +mkdir -p /var/lib/tor/gitweb && mkdir -p /tor + +chown git:git /var/lib/tor/git/ +chown git:git /var/lib/tor/gitweb/ +chown git:git /tor/ +chmod 0700 /var/lib/tor/git/ +chmod 0700 /var/lib/tor/gitweb/ +chmod 0700 /tor + +tor --runasdaemon 0