Cleanup and a bit of modernization in invocation

This commit is contained in:
Leopere 2018-11-29 15:25:59 +00:00
parent 9a67d873f9
commit 68824f95e7

View file

@ -3,61 +3,51 @@ FROM ubuntu:18.04
LABEL MAINTAINER="leopere [at] nixc [dot] us" LABEL MAINTAINER="leopere [at] nixc [dot] us"
RUN apt-get update && apt-get -y install unzip RUN apt-get update && apt-get -y install unzip
# RUN mkdir -pv /data && chown 1000:1000 /data # RUN mkdir -pv /lbrynet && chown 1000:1000 /lbrynet
RUN adduser lbrynet --gecos GECOS --shell /bin/bash/ --disabled-password --home /data/ RUN adduser lbrynet --gecos GECOS --shell /bin/bash/ --disabled-password --home /lbrynet/
## Add lbrynet ## Add lbrynet
ADD https://lbry.io/get/lbrynet.linux.zip /data/lbrynet.linux.zip ADD https://lbry.io/get/lbrynet.linux.zip /lbrynet/lbrynet.linux.zip
RUN unzip /data/lbrynet.linux.zip -d /data/ && \ RUN unzip /lbrynet/lbrynet.linux.zip -d /lbrynet/ && \
rm /data/lbrynet.linux.zip && \ rm /lbrynet/lbrynet.linux.zip && \
chown -Rv traefik:lbrynet /data chown -Rv traefik:lbrynet /lbrynet
RUN wget -quiet -O /usr/bin/debugpaste https://github.com/nixc-us/debugpaste-it/raw/master/bin/debugpaste_64 && \ RUN wget -quiet -O /usr/bin/debugpaste https://github.com/nixc-us/debugpaste-it/raw/master/bin/debugpaste_64 && \
chmod +x /usr/bin/debugpaste chmod +x /usr/bin/debugpaste
## Install into PATH ## Install into PATH
RUN mv /data/lbrynet-* /bin/ RUN mv /lbrynet/lbrynet-* /bin/
COPY debugpaste-it.sh /usr/local/bin/debugpaste-it
## Daemon port [Intended for internal use] ## Daemon port [Intended for internal use]
EXPOSE 4444 EXPOSE 4444
## Wallet port [Intended for internal use] ## LBRYNET talks to peers on port 3333 [Intended for external use] this port is used to discover other lbrynet daemons with blobs.
EXPOSE 50001 EXPOSE 3333
## TODO: Look over these comments and get up to date on what's needed for exclusively lbrynet ## ToDo: Determine why this port isn't documented in the lbry.tech resources for daemon-settings
## Undocumented ports that exist in conf.py # ## Wallet port [Intended for internal use]
## API port # EXPOSE 50001
# EXPOSE 5279 ## All ports that are listed in the networking section of lbry.tech/resources/daemon-settings
# ## Reflector port # 3333 5566 4444 5279
# EXPOSE 5566
## TODO: Highly Important, look over this and switch to managing a YAML config https://lbry.tech/resources/daemon-settings
## VOLUMES
## Right now the volumes are just added in a commented out state but if the end
## user would prefer to add volumes to their own usage cases all they will need
## to do is uncomment what they require and then build the container using docker-compose.yml
## Volumize the wallets in a separate location for backup purposes may be unnecessary. ## Volumize the wallets in a separate location for backup purposes may be unnecessary.
# VOLUME /data/.local/share/lbry/lbryum/wallets # VOLUME /lbrynet/.local/share/lbry/lbryum/wallets
# VOLUME /data/.local/ # VOLUME /lbrynet/.local/
## If the config ends up needing it's own volume it should be located here.
# VOLUME /etc/lbry/conf.py ## Example daemon_settings.yml is at https://github.com/lbryio/lbry/blob/master/example_daemon_settings.yml
## Downloaded blobs will be in their own separate volume for keeping backups of critical secrets and data separate from backups of potentially massive blob files. # VOLUME /etc/lbry/daemon_settings.yml
# VOLUME /data/Downloads/
## Downloaded blobs will be in their own separate volume for keeping backups of critical secrets and data separate from backups of potentially massive blob files.
# VOLUME /lbrynet/Downloads/
## ToDo: replace lbrynet direct execution with start.sh function for enforcing directory perms on container launch.
## TODO: Decide if this next step is ideal or if it would be samrter to run as root to assert volume permissions on launch for improved container statelessness.
## Never run container processes as root ## Never run container processes as root
USER lbrynet USER lbrynet
## TODO: Add start.sh script which can assert permissions and do any configuration prep that's required on container start. ## TODO: Add start.sh script which can assert permissions and do any configuration prep that's required on container start.
## Run on container launch ## Run on container launch
CMD ["lbrynet-daemon"] CMD ["lbrynet", "start"]
## TODO: Cleanup below
## Setting this entrypoint should mean that you can `docker exec lbrynet commands`
## and you should be able to control the daemon's CLI this way. There is an
## alternative method we could use here where we have an entrypoint shell script which could be a bit smarter.
## An docker-entrypoint should eventually be created and installed into the container $PATH with a config install script that checks for the existance of a config.py and if it exists don't install docker envvars established elsewhere.
## If the container doesn't detect a conf.py file however have it install a fresh copy into /etc/lbry/conf.py and run that from a fresh copy from somewhere sensible.
# ENTRYPOINT ["lbrynet-cli"]