feat: use linuxserver.io alpine image

This commit is contained in:
Nicolas Coutin
2019-11-02 16:52:39 +01:00
parent 29344f3c37
commit e33c12bba1
5 changed files with 34 additions and 19 deletions

View File

@@ -1,34 +1,33 @@
FROM alpine:3.10
FROM lsiobase/alpine:3.10
LABEL maintainer "Nicolas Coutin <ilshidur@gmail.com>"
ARG DEBIAN_FRONTEND="noninteractive"
ENV XDG_DATA_HOME="/config" \
XDG_CONFIG_HOME="/config"
ENV TZ America/Los_Angeles
RUN sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories
RUN apk update
RUN apk --no-cache add bash tzdata tor
ENV TZ America/Los_Angeles
EXPOSE 9001
EXPOSE 9001 9030
# TOR configuration through environment variables.
ENV RELAY_TYPE relay
ENV TOR_ORPort 9001
ENV TOR_DataDirectory /var/lib/tor
ENV TOR_DataDirectory /data
ENV TOR_ContactInfo "Random Person nobody@tor.org"
ENV TOR_RelayBandwidthRate "100 KBytes"
ENV TOR_RelayBandwidthBurst "200 KBytes"
COPY torrc.bridge.default /etc/tor/torrc.bridge.default
COPY torrc.relay.default /etc/tor/torrc.relay.default
COPY torrc.exit.default /etc/tor/torrc.exit.default
RUN chown -R tor /etc/tor
# Copy the default configurations.
COPY torrc.bridge.default /config/torrc.bridge.default
COPY torrc.relay.default /config/torrc.relay.default
COPY torrc.exit.default /config/torrc.exit.default
COPY entrypoint.sh /entrypoint.sh
RUN chmod ugo+rx /entrypoint.sh
USER tor
RUN mkdir /var/lib/tor/.tor
VOLUME /var/lib/tor/.tor
RUN chown -R tor /var/lib/tor/.tor
ENTRYPOINT [ "/entrypoint.sh" ]
COPY /root /
VOLUME /data

View File

@@ -1,6 +1,6 @@
# tor-relay-docker
Lightweight TOR relay image, based on Alpine Linux. Configurations can be passed as environment variables.
Lightweight TOR relay image, based on [LinuxServer.io Alpine Linux](https://linuxserver.io). Configurations can be passed as environment variables.
[![dockeri.co](https://dockeri.co/image/ilshidur/tor-relay)](https://hub.docker.com/r/ilshidur/tor-relay)
@@ -18,6 +18,8 @@ docker run \
-e TOR_RelayBandwidthRate="100 KBytes" \
-e TOR_RelayBandwidthBurst="200 KBytes" \
-e TZ=Europe/London \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-v $(pwd)/tor/data:/var/lib/tor:Z \
-p 9001:9001 \
--restart always \
@@ -36,6 +38,8 @@ docker run \
-e TOR_RelayBandwidthRate="100 KBytes" \
-e TOR_RelayBandwidthBurst="200 KBytes" \
-e TZ=Europe/London \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-v $(pwd)/tor/data:/var/lib/tor:Z \
-p 9001:9001 \
--restart always \
@@ -54,6 +58,8 @@ docker run \
-e TOR_RelayBandwidthRate="100 KBytes" \
-e TOR_RelayBandwidthBurst="200 KBytes" \
-e TZ=Europe/London \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-v $(pwd)/tor/data:/var/lib/tor:Z \
-p 9001:9001 \
--restart always \

View File

@@ -2,6 +2,6 @@
set -e
env | grep '^TOR_' | tr "=" " " | cut -c 5- > /etc/tor/torrc
env | grep '^TOR_' | tr "=" " " | cut -c 5- > /config/torrc
exec tor -f /etc/tor/torrc --defaults-torrc "/etc/tor/torrc.${RELAY_TYPE}.default"
exec tor -f /config/torrc --defaults-torrc "/config/torrc.${RELAY_TYPE}.default"

View File

@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bash
chown -R abc:abc \
/data \
/config

View File

@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bash
exec \
s6-setuidgid abc /entrypoint.sh "${RUN_OPTS}"