issue 64: docker setup

This commit is contained in:
SovereigntyIsNotFreedom 2025-06-11 12:25:26 +01:00
parent 0cf9966611
commit 29735fbd86
2 changed files with 52 additions and 11 deletions

View file

@ -1,11 +1,16 @@
####################################################################################
# Setup guide can be found here: https://forum.hackliberty.org/t/how-to-setup-darknet-lantern-on-docker/339
# I have change this file to make the setup process tor friendly
###################################################################################
# Stage 1: Builder stage to clone the Darknet Lantern repository via its onion link. # Stage 1: Builder stage to clone the Darknet Lantern repository via its onion link.
FROM debian:bookworm-slim AS builder FROM quay.io/lib/debian:bookworm-slim AS builder
LABEL stage="builder" LABEL stage="builder"
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Install required utilities. # Install required utilities.
RUN apt-get update && \ RUN apt update && \
apt-get install -y tor git torsocks curl && \ apt install -y tor git torsocks curl && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Create a working directory. # Create a working directory.
@ -17,14 +22,16 @@ ARG LANTERN_REPO="http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfi
# Start tor, wait for bootstrap, and then clone via torsocks. # Start tor, wait for bootstrap, and then clone via torsocks.
RUN set -ex && \ RUN set -ex && \
tor & \ service tor start \
TOR_PID=$! && \
sleep 10 && \ sleep 10 && \
torsocks git clone -v ${LANTERN_REPO} darknet-lantern && \ until curl --proxy socks5h://localhost:9050 -Is https://check.torproject.org | grep "200"; do \
kill ${TOR_PID} echo "Waiting for Tor to bootstrap..."; \
sleep 5; \
done && \
git -c remote.origin.proxy=socks5h://127.0.0.1:9050 clone --depth=1 ${LANTERN_REPO} darknet-lantern
# Stage 2: Final runtime image. # Stage 2: Final runtime image.
FROM debian:bookworm-slim FROM quay.io/lib/debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Note: Do not hard-code INSTANCE_DOMAIN here. # Note: Do not hard-code INSTANCE_DOMAIN here.
@ -34,8 +41,8 @@ ENV DEBIAN_FRONTEND=noninteractive
# - INSTANCE_DOMAIN=lantern.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion # - INSTANCE_DOMAIN=lantern.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion
# Install runtime dependencies (including cron and git). # Install runtime dependencies (including cron and git).
RUN apt-get update && \ RUN apt update &&\
apt-get install -y \ apt install -y \
nginx \ nginx \
php8.2-fpm \ php8.2-fpm \
python3 \ python3 \
@ -55,7 +62,7 @@ RUN pip3 install --upgrade pip --break-system-packages && \
pip3 install --no-cache-dir --break-system-packages -r /srv/darknet-lantern/requirements.txt pip3 install --no-cache-dir --break-system-packages -r /srv/darknet-lantern/requirements.txt
# Configure nginx. # Configure nginx.
COPY ./lantern_nginx_conf/lantern.conf /etc/nginx/sites-available/lantern.conf COPY nginx.conf /etc/nginx/sites-available/lantern.conf
RUN ln -sf /etc/nginx/sites-available/lantern.conf /etc/nginx/sites-enabled/ && \ RUN ln -sf /etc/nginx/sites-available/lantern.conf /etc/nginx/sites-enabled/ && \
rm -f /etc/nginx/sites-enabled/default rm -f /etc/nginx/sites-enabled/default

34
docker-compose.yml Normal file
View file

@ -0,0 +1,34 @@
networks:
tor:
lantern:
services:
darknet-lantern:
build: .
container_name: darknet-lantern
volumes:
- ./lantern_data:/srv/darknet-lantern/www/participants # Persist Darknet Lantern application data if needed.
- ./lantern_nginx_conf:/etc/nginx/sites-enabled # persist your nginx configuration.
networks:
- tor
- lantern
restart: unless-stopped
tor:
image: osminogin/tor-simple
container_name: tor
volumes:
- ./tor-data:/var/lib/tor
- ./tor-data/torrc:/etc/tor/torrc
networks:
- tor
restart: unless-stopped
tor-proxy:
image: osminogin/tor-simple
container_name: tor-proxy
volumes:
- ./tor-proxy:/var/lib/tor
- ./tor-proxy/torrc:/etc/tor
networks:
- tor