Add ENTRYPOINT script with support for custom torrc

This commit is contained in:
Henrik Jonsson 2017-01-26 20:20:37 +01:00
parent ec627a8b59
commit 8105b400b3
3 changed files with 35 additions and 5 deletions

View File

@ -1,7 +1,5 @@
FROM debian FROM debian
# TODO(hkjn): Use alpine as base.
MAINTAINER Henrik Jonsson <me@hkjn.me> MAINTAINER Henrik Jonsson <me@hkjn.me>
ENV TOR_VERSION=7.0a1-hardened ENV TOR_VERSION=7.0a1-hardened
@ -45,5 +43,6 @@ RUN curl --fail -O -sSL ${RELEASE_URL} && \
WORKDIR /usr/local/bin/Browser/Downloads WORKDIR /usr/local/bin/Browser/Downloads
USER user USER user
ENTRYPOINT ["start-tor-browser"] COPY ["start", "/usr/local/bin/"]
ENTRYPOINT ["start"]
CMD [""] CMD [""]

View File

@ -1,5 +1,22 @@
# tor-browser # tor-browser
[![](https://badge.imagelayers.io/hkjn/tor-browser:latest.svg)](https://imagelayers.io/?images=hkjn/tor-browser:latest 'Get your own badge on imagelayers.io') This repo defines the `hkjn/tor-browser` Docker image.
This repo defines the `hkjn/tor-browser` Docker image. You can run tor-browser in a container with a command like:
```
docker run -it --rm --name tor-browser \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-e DISPLAY=unix$DISPLAY \
hkjn/tor-browser
```
If you want to specify a custom `torrc` file, that can be done with:
```
docker run -it --rm --name tor-browser \
-v /host/dir/containing/torrc:/conf \
-e TORRC_PATH=/conf/torrc \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-e DISPLAY=unix$DISPLAY \
hkjn/tor-browser
```

14
start Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
#
# Entrypoint script for tor-browser.
#
set -euo pipefail
TORRC_PATH=${TORRC_PATH:-""}
[[ "$TORRC_PATH" ]] && echo "$(date) [ $(basename $0) ] Using torrc file from '$TORRC_PATH'.."
[[ -e "$TORRC_PATH" ]] {
echo "$(date) [ $(basename $0) ] FATAL: No such file '$TORRC_PATH'." >&1
exit 1
}
cp -v "$TORRC_PATH" /usr/local/bin/Browser/TorBrowser/Data/Tor/torrc
start-tor-browser "$@"