Update Dockerfile tor service init, refactor rc/ -> misc/

The tor service is now started by calling a script which runs tor
according to the current container user. If the user is root, the script
will begin the tor service as normal. Otherwise, it runs tor as the
current user. This primarily is meant to address the issue with Heroku
builds (which don't have a root user) not being able to start tor as a
service.

Also refactored the rc/ dir to misc/ (with a tor/ subdir) since that
makes more sense.
このコミットが含まれているのは:
Ben Busby 2020-10-28 22:18:29 -04:00
コミット 7a61220aa5
3個のファイルの変更9行の追加2行の削除

ファイルの表示

@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y \
libssl-dev \
tor
COPY rc/torrc /etc/tor/torrc
COPY misc/tor/torrc /etc/tor/torrc
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
@ -40,4 +40,4 @@ COPY . .
EXPOSE $EXPOSE_PORT
CMD service tor start && ./run
CMD misc/tor/start-tor.sh & ./run

7
misc/tor/start-tor.sh 実行可能ファイル
ファイルの表示

@ -0,0 +1,7 @@
#!/bin/bash
if [ "$(whoami)" != "root" ]; then
tor -f /etc/tor/torrc
else
service tor start
fi

ファイルの表示