mirror of
https://github.com/cmehay/docker-tor-hidden-service.git
synced 2025-04-20 22:09:10 +00:00
Dockerfile: Add torsocks binary.
This has two purposes: 1) The 'torify' wrapper is already included, and it needs torsocks. 2) Use torsocks for health checking your onion service like this: healthcheck: test: ["CMD-SHELL", "torsocks nc -z <onion address> <port> || exit 1"] interval: 2m
This commit is contained in:
parent
c08f702da1
commit
2c529b7b80
4 changed files with 18 additions and 2 deletions
12
Dockerfile
12
Dockerfile
|
@ -1,5 +1,6 @@
|
||||||
FROM python:3.8-alpine
|
FROM python:3.8-alpine
|
||||||
ARG tor_version
|
ARG tor_version
|
||||||
|
ARG torsocks_version
|
||||||
|
|
||||||
ENV HOME /var/lib/tor
|
ENV HOME /var/lib/tor
|
||||||
ENV POETRY_VIRTUALENVS_CREATE=false
|
ENV POETRY_VIRTUALENVS_CREATE=false
|
||||||
|
@ -21,6 +22,17 @@ RUN apk add --no-cache git bind-tools libevent-dev openssl-dev gnupg gcc mak
|
||||||
apk del git libevent-dev openssl-dev gnupg make automake autoconf musl-dev coreutils libffi-dev && \
|
apk del git libevent-dev openssl-dev gnupg make automake autoconf musl-dev coreutils libffi-dev && \
|
||||||
apk add --no-cache libevent openssl
|
apk add --no-cache libevent openssl
|
||||||
|
|
||||||
|
RUN apk add --no-cache git gcc make automake autoconf musl-dev libtool && \
|
||||||
|
git clone https://git.torproject.org/torsocks.git /usr/local/src/torsocks && \
|
||||||
|
cd /usr/local/src/torsocks && \
|
||||||
|
git checkout $torsocks_version && \
|
||||||
|
./autogen.sh && \
|
||||||
|
./configure && \
|
||||||
|
make && make install && \
|
||||||
|
cd .. && \
|
||||||
|
rm -rf torsocks && \
|
||||||
|
apk del git gcc make automake autoconf musl-dev libtool
|
||||||
|
|
||||||
RUN mkdir -p /etc/tor/
|
RUN mkdir -p /etc/tor/
|
||||||
|
|
||||||
COPY pyproject.toml /usr/local/src/onions/
|
COPY pyproject.toml /usr/local/src/onions/
|
||||||
|
|
5
Makefile
5
Makefile
|
@ -1,6 +1,7 @@
|
||||||
.EXPORT_ALL_VARIABLES:
|
.EXPORT_ALL_VARIABLES:
|
||||||
|
|
||||||
TOR_VERSION = $(shell bash last_tor_version.sh)
|
TOR_VERSION = $(shell bash last_tor_version.sh)
|
||||||
|
TORSOCKS_VERSION = $(shell bash last_torsocks_version.sh)
|
||||||
CUR_COMMIT = $(shell git rev-parse --short HEAD)
|
CUR_COMMIT = $(shell git rev-parse --short HEAD)
|
||||||
CUR_TAG = v$(TOR_VERSION)-$(CUR_COMMIT)
|
CUR_TAG = v$(TOR_VERSION)-$(CUR_COMMIT)
|
||||||
|
|
||||||
|
@ -17,11 +18,11 @@ check:
|
||||||
pre-commit run --all-files
|
pre-commit run --all-files
|
||||||
|
|
||||||
build:
|
build:
|
||||||
- echo build with tor version $(TOR_VERSION)
|
- echo build with tor version $(TOR_VERSION) and torsocks version $(TORSOCKS_VERSION)
|
||||||
docker-compose -f docker-compose.build.yml build
|
docker-compose -f docker-compose.build.yml build
|
||||||
|
|
||||||
rebuild:
|
rebuild:
|
||||||
- echo rebuild with tor version $(TOR_VERSION)
|
- echo rebuild with tor version $(TOR_VERSION) and torsocks version $(TORSOCKS_VERSION)
|
||||||
docker-compose -f docker-compose.build.yml build --no-cache
|
docker-compose -f docker-compose.build.yml build --no-cache
|
||||||
|
|
||||||
run: build
|
run: build
|
||||||
|
|
|
@ -9,3 +9,4 @@ services:
|
||||||
context: .
|
context: .
|
||||||
args:
|
args:
|
||||||
tor_version: $TOR_VERSION
|
tor_version: $TOR_VERSION
|
||||||
|
torsocks_version: $TORSOCKS_VERSION
|
||||||
|
|
2
last_torsocks_version.sh
Executable file
2
last_torsocks_version.sh
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
git ls-remote --tags https://git.torproject.org/torsocks.git | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1
|
Loading…
Add table
Reference in a new issue