diff --git a/Dockerfile b/Dockerfile index f5c286f..0e60e60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,5 @@ FROM debian -# TODO(hkjn): Use alpine as base. - MAINTAINER Henrik Jonsson ENV TOR_VERSION=7.0a1-hardened @@ -45,5 +43,6 @@ RUN curl --fail -O -sSL ${RELEASE_URL} && \ WORKDIR /usr/local/bin/Browser/Downloads USER user -ENTRYPOINT ["start-tor-browser"] +COPY ["start", "/usr/local/bin/"] +ENTRYPOINT ["start"] CMD [""] diff --git a/README.md b/README.md index 4411b3e..95871d0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,22 @@ # 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. \ No newline at end of file +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 +``` \ No newline at end of file diff --git a/start b/start new file mode 100755 index 0000000..a96a0c7 --- /dev/null +++ b/start @@ -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 "$@"