Parse multiple ports from environment

pull/10/head
Christophe Mehay 7 years ago
parent f5b25abd3c
commit 3843fe5bd3

@ -2,11 +2,11 @@ FROM alpine
ENV HOME /var/lib/tor
RUN apk add --no-cache git libevent-dev openssl-dev gcc make automake ca-certificates autoconf musl-dev && \
RUN apk add --no-cache git libevent-dev openssl-dev gcc make automake ca-certificates autoconf musl-dev coreutils && \
mkdir -p /usr/local/src/ && \
git clone https://git.torproject.org/tor.git /usr/local/src/tor && \
cd /usr/local/src/tor && \
git checkout $(git tag | tail -1) && \
git checkout $(git branch -a | grep 'release' | sort -V | tail -1) && \
./autogen.sh && \
./configure \
--disable-asciidoc \
@ -19,7 +19,7 @@ RUN apk add --no-cache git libevent-dev openssl-dev gcc make automake ca-cer
python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip3 install --upgrade pip setuptools pycrypto && \
apk del git libevent-dev openssl-dev make automake python3-dev gcc autoconf musl-dev && \
apk del git libevent-dev openssl-dev make automake python3-dev gcc autoconf musl-dev coreutils && \
apk add --no-cache libevent openssl
ADD assets/entrypoint-config.yml /

@ -72,7 +72,8 @@ environment:
# Set mapping ports
HELLO_PORTS: 80:80
WORLD_PORTS: 8000:80
# Multiple ports can be coma separated
WORLD_PORTS: 8000:80,8888:80,22:22
```

@ -17,6 +17,6 @@ post_conf_commands:
reload:
files:
- /etc/torrc
- /etc/tor/torrc
debug: false

@ -45,10 +45,11 @@ class Setup(object):
self._add_host(host)
if 'ports' not in self.setup[host]:
self.setup[host]['ports'] = []
port = [int(p) for p in ports.split(':')]
assert len(port) == 2
if port not in self.setup[host]['ports']:
self.setup[host]['ports'].append(port)
ports_l = [[int(v) for v in sp.split(':')] for sp in ports.split(',')]
for port in ports_l:
assert len(port) == 2
if port not in self.setup[host]['ports']:
self.setup[host]['ports'].append(port)
def _get_ip(self):
for host in self.setup:

@ -11,7 +11,7 @@ services:
- world
environment:
# Set mapping ports
HELLO_PORTS: 80:80
HELLO_PORTS: 80:80,800:80,8888:80
# Set private key
HELLO_KEY: |
-----BEGIN RSA PRIVATE KEY-----
@ -34,7 +34,7 @@ services:
# Keep keys in volumes
volumes:
- ./keys:/var/lib/tor/hidden_service/
- tor-keys:/var/lib/tor/hidden_service/
hello:
image: tutum/hello-world
@ -43,3 +43,7 @@ services:
world:
image: tutum/hello-world
hostname: world
volumes:
tor-keys:
driver: local

Loading…
Cancel
Save