Browse Source

Added Dockerfile

pull/6/head
l-n-s 7 years ago
parent
commit
bfc600b4ef
  1. 28
      contrib/docker/Dockerfile
  2. 30
      contrib/docker/README.md
  3. 23
      contrib/docker/entrypoint.sh

28
contrib/docker/Dockerfile

@ -0,0 +1,28 @@
FROM alpine:latest
LABEL authors "Darknet Villain <supervillain@riseup.net>"
ENV PYSEEDER_HOME="/home/pyseeder"
ENV DATA_DIR="${PYSEEDER_HOME}/data"
RUN mkdir -p "$PYSEEDER_HOME" "$DATA_DIR" "$DATA_DIR"/data "$DATA_DIR"/output \
&& adduser -S -h "$PYSEEDER_HOME" pyseeder \
&& chown -R pyseeder:nobody "$PYSEEDER_HOME" \
&& chmod -R 700 "$DATA_DIR"
RUN apk --no-cache add python3 py3-pip build-base git openssl-dev musl-dev python3-dev libffi-dev \
&& pip3 install --no-cache-dir https://github.com/PurpleI2P/pyseeder/zipball/master \
&& apk --purge del python3 py3-pip build-base git openssl-dev musl-dev python3-dev libffi-dev
# 2. Adding required libraries to run i2pd to ensure it will run.
RUN apk --no-cache add python3 openssl
VOLUME "$DATA_DIR"
USER pyseeder
COPY entrypoint.sh /entrypoint.sh
RUN chmod a+x /entrypoint.sh
EXPOSE 8443
ENTRYPOINT [ "/entrypoint.sh" ]

30
contrib/docker/README.md

@ -0,0 +1,30 @@
Pyseeder docker container
=========================
Using it with i2pd container:
1) Run i2pd docker container and locate it's datadir volume with `docker inspect <container>`
It will show something like that:
...
"Mounts": [
{
"Name": "69c5fb747b09701acebcf22478f99719e87ac65b3ac11464cd949bebe03a744a",
"Source": "/var/lib/docker/volumes/69c5fb747b09701acebcf22478f99719e87ac65b3ac11464cd949bebe03a744a/_data",
"Destination": "/home/i2pd/data",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
...
2) Run pyseeder image with that volume mounted at `/i2pd_data`:
docker run --name=test10 -P -dt -v 69c5fb747b09701acebcf22478f99719e87ac65b3ac11464cd949bebe03a744a:/i2pd_data pyseeder
3) Enjoy your reseed.

23
contrib/docker/entrypoint.sh

@ -0,0 +1,23 @@
#!/bin/sh
COMMAND="pyseeder"
if [ "$1" = "--help" ]; then
$COMMAND --help
else
# TODO
# make configurable SIGNER_ID and cert, key etc
DATA_DIR="/home/pyseeder/data"
SIGNER_ID="test@mail.i2p"
PRIVKEY_FILE="$DATA_DIR/data/private_key.pem"
CERT_FILE=` echo $DATA_DIR/data/$SIGNER_ID.crt | sed 's/@/_at_/' `
RESEED_FILE="$DATA_DIR/output/i2pseeds.su3"
I2PD_DIR="/i2pd_data"
$COMMAND keygen --signer-id $SIGNER_ID --no-encrypt \
--private-key $PRIVKEY_FILE --cert $CERT_FILE
$COMMAND reseed --netdb $I2PD_DIR/netDb --signer-id $SIGNER_ID --no-encrypt \
--private-key $PRIVKEY_FILE --outfile $RESEED_FILE
$COMMAND serve --private-key $PRIVKEY_FILE --cert $CERT_FILE --file $RESEED_FILE
fi
Loading…
Cancel
Save