Update/rewrite docker files
This commit is contained in:
parent
47db0898e2
commit
92eb6c8ca1
10 changed files with 111 additions and 59 deletions
|
@ -1,3 +1,5 @@
|
|||
venv
|
||||
Dockerfile*
|
||||
docker
|
||||
data
|
||||
__pycahce__
|
||||
log
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -19,6 +19,7 @@ __pycache__/
|
|||
|
||||
# Data dir
|
||||
data/*
|
||||
docker/data/
|
||||
*.db
|
||||
|
||||
# Virtualenv
|
||||
|
|
17
Dockerfile
17
Dockerfile
|
@ -1,17 +0,0 @@
|
|||
FROM python:3.10.4-alpine
|
||||
|
||||
RUN apk --update --no-cache --no-progress add gcc libffi-dev musl-dev make openssl g++
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
RUN python3 -m venv venv \
|
||||
&& source venv/bin/activate \
|
||||
&& python3 -m pip install -r requirements.txt
|
||||
|
||||
CMD source venv/bin/activate \
|
||||
&& python3 zeronet.py --ui_ip "*" --fileserver_port 26552 \
|
||||
--tor $TOR_ENABLED --tor_controller tor:$TOR_CONTROL_PORT \
|
||||
--tor_proxy tor:$TOR_SOCKS_PORT --tor_password $TOR_CONTROL_PASSWD main
|
||||
|
||||
EXPOSE 43110 26552
|
|
@ -1,18 +0,0 @@
|
|||
FROM python:3.10.4-alpine
|
||||
|
||||
RUN apk --update --no-cache --no-progress add tor gcc libffi-dev musl-dev make openssl g++ \
|
||||
&& echo "ControlPort 9051" >> /etc/tor/torrc \
|
||||
&& echo "CookieAuthentication 1" >> /etc/tor/torrc
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
RUN python3 -m venv venv \
|
||||
&& source venv/bin/activate \
|
||||
&& python3 -m pip install -r requirements.txt
|
||||
|
||||
CMD (tor&) \
|
||||
&& source venv/bin/activate \
|
||||
&& python3 zeronet.py --ui_ip "*" --fileserver_port 26552
|
||||
|
||||
EXPOSE 43110 26552
|
|
@ -1,10 +0,0 @@
|
|||
FROM alpine:3.16.0
|
||||
|
||||
RUN apk --update --no-cache --no-progress add tor
|
||||
|
||||
CMD hashed_control_password=$(tor --quiet --hash-password $TOR_CONTROL_PASSWD) \
|
||||
&& tor --SocksPort 0.0.0.0:$TOR_SOCKS_PORT \
|
||||
--ControlPort 0.0.0.0:$TOR_CONTROL_PORT \
|
||||
--HashedControlPassword $hashed_control_password
|
||||
|
||||
EXPOSE $TOR_SOCKS_PORT $TOR_CONTROL_PORT
|
25
docker/Dockerfile
Normal file
25
docker/Dockerfile
Normal file
|
@ -0,0 +1,25 @@
|
|||
FROM python:3.12-alpine
|
||||
|
||||
RUN apk --update --no-cache --no-progress add git gcc libffi-dev musl-dev make openssl g++ autoconf automake libtool
|
||||
|
||||
RUN adduser -u 1600 -D service-0net
|
||||
|
||||
USER service-0net:service-0net
|
||||
|
||||
WORKDIR /home/service-0net
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
|
||||
# the part below is updated with source updates
|
||||
|
||||
COPY . .
|
||||
|
||||
ENTRYPOINT python3 zeronet.py --ui_ip "*" --fileserver_port 26552 \
|
||||
--tor $TOR_ENABLED --tor_controller tor:$TOR_CONTROL_PORT \
|
||||
--tor_proxy tor:$TOR_SOCKS_PORT --tor_password $TOR_CONTROL_PASSWD
|
||||
|
||||
CMD main
|
||||
|
||||
EXPOSE 43110 26552
|
26
docker/debian.Dockerfile
Normal file
26
docker/debian.Dockerfile
Normal file
|
@ -0,0 +1,26 @@
|
|||
FROM python:3.12-slim-bookworm
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install git openssl pkg-config libffi-dev python3-pip python3-dev build-essential libtool
|
||||
|
||||
RUN useradd -u 1600 -m service-0net
|
||||
|
||||
USER service-0net:service-0net
|
||||
|
||||
WORKDIR /home/service-0net
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
|
||||
# the part below is updated with source updates
|
||||
|
||||
COPY . .
|
||||
|
||||
ENTRYPOINT python3 zeronet.py --ui_ip "*" --fileserver_port 26552 \
|
||||
--tor $TOR_ENABLED --tor_controller tor:$TOR_CONTROL_PORT \
|
||||
--tor_proxy tor:$TOR_SOCKS_PORT --tor_password $TOR_CONTROL_PASSWD
|
||||
|
||||
CMD main
|
||||
|
||||
EXPOSE 43110 26552
|
|
@ -1,29 +1,31 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
tor:
|
||||
tty: true
|
||||
stdin_open: true
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.tor
|
||||
context: ..
|
||||
dockerfile: docker/tor.Dockerfile
|
||||
networks:
|
||||
- 0net-network
|
||||
ports:
|
||||
- "9050:9050"
|
||||
- "9051:9051"
|
||||
environment: &tor-environments
|
||||
# since we are using tor internally, password doesn't really matter
|
||||
TOR_CONTROL_PASSWD: some_password
|
||||
TOR_SOCKS_PORT: 9050
|
||||
TOR_CONTROL_PORT: 9051
|
||||
0net:
|
||||
|
||||
0net-conservancy:
|
||||
tty: true
|
||||
stdin_open: true
|
||||
build:
|
||||
context: .
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
networks:
|
||||
- 0net-network
|
||||
volumes:
|
||||
- 0net-data:/app/data
|
||||
# NOTE: this refers to docker/data..
|
||||
- ./data:/home/service-0net/data
|
||||
ports:
|
||||
- "26552:26552"
|
||||
- "43110:43110"
|
||||
|
@ -32,20 +34,21 @@ services:
|
|||
environment:
|
||||
TOR_ENABLED: enable
|
||||
<<: *tor-environments
|
||||
|
||||
0net-tor:
|
||||
tty: true
|
||||
stdin_open: true
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.integrated_tor
|
||||
context: ..
|
||||
dockerfile: docker/znctor.Dockerfile
|
||||
networks:
|
||||
- 0net-network
|
||||
volumes:
|
||||
- 0net-data:/app/data
|
||||
# NOTE: this refers to docker/data..
|
||||
- ./data:/home/service-0net/data
|
||||
ports:
|
||||
- "26552:26552"
|
||||
- "43110:43110"
|
||||
volumes:
|
||||
0net-data:
|
||||
|
||||
networks:
|
||||
0net-network:
|
9
docker/tor.Dockerfile
Normal file
9
docker/tor.Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
|||
FROM alpine:3.18
|
||||
|
||||
RUN apk --update --no-cache --no-progress add tor
|
||||
|
||||
USER tor
|
||||
|
||||
CMD tor --SocksPort 0.0.0.0:${TOR_SOCKS_PORT} --ControlPort 0.0.0.0:${TOR_CONTROL_PORT} --HashedControlPassword $(tor --quiet --hash-password $TOR_CONTROL_PASSWD)
|
||||
|
||||
EXPOSE $TOR_SOCKS_PORT $TOR_CONTROL_PORT
|
31
docker/znctor.Dockerfile
Normal file
31
docker/znctor.Dockerfile
Normal file
|
@ -0,0 +1,31 @@
|
|||
FROM python:3.12-alpine
|
||||
|
||||
RUN apk --update --no-cache --no-progress add git gcc libffi-dev musl-dev make openssl g++ autoconf automake libtool
|
||||
RUN apk add tor
|
||||
|
||||
RUN echo "ControlPort 9051" >> /etc/tor/torrc
|
||||
RUN echo "CookieAuthentication 1" >> /etc/tor/torrc
|
||||
|
||||
RUN adduser -u 1600 -D service-0net
|
||||
|
||||
USER service-0net:service-0net
|
||||
|
||||
WORKDIR /home/service-0net
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
|
||||
RUN echo "tor &" > start.sh
|
||||
RUN echo "python3 zeronet.py --ui_ip '*' --fileserver_port 26552" >> start.sh
|
||||
RUN chmod +x start.sh
|
||||
|
||||
# the part below is updated with source updates
|
||||
|
||||
COPY . .
|
||||
|
||||
ENTRYPOINT ./start.sh
|
||||
|
||||
CMD main
|
||||
|
||||
EXPOSE 43110 26552
|
Loading…
Reference in a new issue