Adds ENTRYPOINT to lbrynet to require mounted home directory before execution.

This commit is contained in:
Ryan McGuire 2019-04-25 08:06:38 -04:00
parent 69c8468e8f
commit 70ae63d02a
3 changed files with 21 additions and 4 deletions

View file

@ -37,18 +37,21 @@ RUN git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba
WORKDIR /lbry/torba WORKDIR /lbry/torba
RUN python3.7 -m pip install -e . RUN python3.7 -m pip install -e .
WORKDIR /lbry/ WORKDIR /lbry/
COPY stuff/start.sh /usr/local/bin/start
COPY stuff/checkmount.sh /usr/local/bin/checkmount
RUN python3.7 scripts/set_build.py && \ RUN python3.7 scripts/set_build.py && \
python3.7 -m pip install -e . && \ python3.7 -m pip install -e . && \
pyinstaller -F -n lbrynet lbrynet/extras/cli.py && \ pyinstaller -F -n lbrynet lbrynet/extras/cli.py && \
chmod +x /lbry/dist/lbrynet && \ chmod +x /lbry/dist/lbrynet && \
zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \ zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \
chmod a+x /usr/local/bin/* && \
mkdir /target && \ mkdir /target && \
/lbry/dist/lbrynet --version /lbry/dist/lbrynet --version
FROM multiarch/ubuntu-core:armhf-bionic as app FROM multiarch/ubuntu-core:armhf-bionic as app
RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet
COPY stuff/start.sh /usr/local/bin/start COPY --from=compile /usr/local/bin/start /usr/local/bin/checkmount /lbry/dist/lbrynet /usr/local/bin/
COPY --from=compile /lbry/dist/lbrynet /usr/local/bin/
EXPOSE 5279 EXPOSE 5279
USER lbrynet USER lbrynet
ENTRYPOINT ["/usr/local/bin/checkmount"]
CMD ["start"] CMD ["start"]

View file

@ -37,18 +37,21 @@ RUN git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba
WORKDIR /lbry/torba WORKDIR /lbry/torba
RUN python3.7 -m pip install -e . RUN python3.7 -m pip install -e .
WORKDIR /lbry/ WORKDIR /lbry/
COPY stuff/start.sh /usr/local/bin/start
COPY stuff/checkmount.sh /usr/local/bin/checkmount
RUN python3.7 scripts/set_build.py && \ RUN python3.7 scripts/set_build.py && \
python3.7 -m pip install -e . && \ python3.7 -m pip install -e . && \
pyinstaller -F -n lbrynet lbrynet/extras/cli.py && \ pyinstaller -F -n lbrynet lbrynet/extras/cli.py && \
chmod +x /lbry/dist/lbrynet && \ chmod +x /lbry/dist/lbrynet && \
zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \ zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \
chmod a+x /usr/local/bin/* && \
mkdir /target && \ mkdir /target && \
/lbry/dist/lbrynet --version /lbry/dist/lbrynet --version
FROM ubuntu:18.04 as app FROM ubuntu:18.04 as app
RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet
COPY stuff/start.sh /usr/local/bin/start COPY --from=compile /usr/local/bin/start /usr/local/bin/checkmount /lbry/dist/lbrynet /usr/local/bin/
COPY --from=compile /lbry/dist/lbrynet /usr/local/bin/
EXPOSE 5279 EXPOSE 5279
USER lbrynet USER lbrynet
ENTRYPOINT ["/usr/local/bin/checkmount"]
CMD ["start"] CMD ["start"]

View file

@ -0,0 +1,11 @@
#!/bin/bash
mountpoint=/home/lbrynet
if ! grep -qs ".* $mountpoint " /proc/mounts; then
echo "$mountpoint not mounted, refusing to run."
exit 1
else
`$@`
fi