Skip to content

Commit

Permalink
Adds ENTRYPOINT to lbrynet to require mounted home directory before e…
Browse files Browse the repository at this point in the history
…xecution.
EnigmaCurry committed Apr 27, 2019
1 parent 69c8468 commit 70ae63d
Showing 3 changed files with 21 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lbrynet/Dockerfile-armhf-compiler
Original file line number Diff line number Diff line change
@@ -37,18 +37,21 @@ RUN git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba
WORKDIR /lbry/torba
RUN python3.7 -m pip install -e .
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 && \
python3.7 -m pip install -e . && \
pyinstaller -F -n lbrynet lbrynet/extras/cli.py && \
chmod +x /lbry/dist/lbrynet && \
zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \
chmod a+x /usr/local/bin/* && \
mkdir /target && \
/lbry/dist/lbrynet --version

FROM multiarch/ubuntu-core:armhf-bionic as app
RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet
COPY stuff/start.sh /usr/local/bin/start
COPY --from=compile /lbry/dist/lbrynet /usr/local/bin/
COPY --from=compile /usr/local/bin/start /usr/local/bin/checkmount /lbry/dist/lbrynet /usr/local/bin/
EXPOSE 5279
USER lbrynet
ENTRYPOINT ["/usr/local/bin/checkmount"]
CMD ["start"]
7 changes: 5 additions & 2 deletions lbrynet/Dockerfile-x86_64-compiler
Original file line number Diff line number Diff line change
@@ -37,18 +37,21 @@ RUN git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba
WORKDIR /lbry/torba
RUN python3.7 -m pip install -e .
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 && \
python3.7 -m pip install -e . && \
pyinstaller -F -n lbrynet lbrynet/extras/cli.py && \
chmod +x /lbry/dist/lbrynet && \
zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \
chmod a+x /usr/local/bin/* && \
mkdir /target && \
/lbry/dist/lbrynet --version

FROM ubuntu:18.04 as app
RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet
COPY stuff/start.sh /usr/local/bin/start
COPY --from=compile /lbry/dist/lbrynet /usr/local/bin/
COPY --from=compile /usr/local/bin/start /usr/local/bin/checkmount /lbry/dist/lbrynet /usr/local/bin/
EXPOSE 5279
USER lbrynet
ENTRYPOINT ["/usr/local/bin/checkmount"]
CMD ["start"]
11 changes: 11 additions & 0 deletions lbrynet/stuff/checkmount.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 70ae63d

Please sign in to comment.