Three stage Dockerfile for lbrynet ARM and X86_64

This commit is contained in:
Ryan McGuire 2019-04-23 16:33:24 -04:00 committed by Leopere
parent 868c00b4cb
commit 1d3e5b7a39
4 changed files with 100 additions and 107 deletions

View file

@ -1,7 +1,6 @@
FROM multiarch/ubuntu-core:armhf-bionic FROM multiarch/ubuntu-core:armhf-bionic as dependencies
RUN apt-get update && \
RUN apt update && \ apt-get install -y \
apt install -y \
python3-pip \ python3-pip \
python3.7 \ python3.7 \
python3.7-dev \ python3.7-dev \
@ -21,35 +20,33 @@ RUN apt update && \
liblzma-dev \ liblzma-dev \
libsqlite3-dev \ libsqlite3-dev \
zip \ zip \
libffi-dev libffi-dev \
libleveldb-dev && \
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 && \ update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 10 && \ update-alternatives --install /usr/bin/python python /usr/bin/python3.7 10 && \
update-alternatives --config python && \ update-alternatives --config python && \
python --version && \ python --version && \
pip3 --version pip3 --version
FROM dependencies as compile
RUN python3.7 -m pip install -U pyinstaller cryptography aiohttp coincurve pbkdf2 cryptography attrs pylru RUN python3.7 -m pip install -U pyinstaller && \
git clone https://github.com/lbryio/lbry.git --depth 1 /lbry && \
## SPLIT CONTAINER HERE.
RUN git clone https://github.com/lbryio/lbry.git --depth 1 /lbry && \
cd /lbry && \ cd /lbry && \
git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba && \
cd /lbry/torba && python3.7 -m pip install -e . && \
RUN sed -i -e "s/'plyvel',//" /lbry/torba/setup.py && \ cd /lbry/ && python3.7 scripts/set_build.py && \
cd /lbry/torba && python3.7 -m pip install -e . && cd /lbry/ && \
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 && \
zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \
mkdir /target && \
/lbry/dist/lbrynet --version
RUN echo "checking contents of /lbry/dist/" && ls -lAh /lbry/dist/ && \ FROM multiarch/ubuntu-core:armhf-bionic as app
echo "checking contents of /" && ls -lAh / && \ RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet
echo "redundantly setting executable bit for good measure" && chmod +x /lbry/dist/lbrynet && \ COPY start.sh /usr/local/bin/start
echo "compressing lbrynet armhf binary" && zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \ COPY --from=compile /lbry/dist/lbrynet /usr/local/bin/
echo "creating /target/" && mkdir /target EXPOSE 5279
COPY ./start.sh /usr/local/bin/start USER lbrynet
CMD ["start"]
RUN /lbry/dist/lbrynet --version
CMD start

3
lbrynet/linux-armhf-compiler/start.sh Executable file → Normal file
View file

@ -1,3 +1,2 @@
#!/bin/bash #!/bin/bash
sleep 2 echo "TODO"
cp /lbry/dist/lbrynet-armhf.zip /target/

View file

@ -1,7 +1,6 @@
FROM ubuntu:18.04 FROM ubuntu:18.04 as dependencies
RUN apt-get update && \
RUN apt update && \ apt-get install -y \
apt install -y \
python3-pip \ python3-pip \
python3.7 \ python3.7 \
python3.7-dev \ python3.7-dev \
@ -21,34 +20,33 @@ RUN apt update && \
liblzma-dev \ liblzma-dev \
libsqlite3-dev \ libsqlite3-dev \
zip \ zip \
libffi-dev libffi-dev \
libleveldb-dev && \
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 && \ update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 10 && \ update-alternatives --install /usr/bin/python python /usr/bin/python3.7 10 && \
update-alternatives --config python && \ update-alternatives --config python && \
python --version && \ python --version && \
pip3 --version pip3 --version
FROM dependencies as compile
RUN python3.7 -m pip install -U pyinstaller cryptography aiohttp coincurve pbkdf2 cryptography attrs pylru RUN python3.7 -m pip install -U pyinstaller && \
git clone https://github.com/lbryio/lbry.git --depth 1 /lbry && \
## Split container here.
RUN git clone https://github.com/lbryio/lbry.git --depth 1 /lbry && \
cd /lbry && \ cd /lbry && \
git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba git clone https://github.com/lbryio/torba.git --depth 1 /lbry/torba && \
cd /lbry/torba && python3.7 -m pip install -e . && \
RUN cd /lbry/torba && python3.7 -m pip install -e . && cd /lbry/ && \ cd /lbry/ && python3.7 scripts/set_build.py && \
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 && \
zip -j /lbry/dist/lbrynet-armhf.zip /lbry/dist/lbrynet && \
mkdir /target && \
/lbry/dist/lbrynet --version
RUN echo "checking contents of /lbry/dist/" && ls -lAh /lbry/dist/ && \ FROM ubuntu:18.04 as app
echo "checking contents of /" && ls -lAh / && \ RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet
echo "redundantly setting executable bit for good measure" && chmod +x /lbry/dist/lbrynet && \ COPY start.sh /usr/local/bin/start
echo "compressing lbrynet x86_64 binary" && zip -j /lbry/dist/lbrynet-x86_64.zip /lbry/dist/lbrynet && \ COPY --from=compile /lbry/dist/lbrynet /usr/local/bin/
echo "creating /target/" && mkdir /target EXPOSE 5279
COPY ./start.sh /usr/local/bin/start USER lbrynet
CMD ["start"]
RUN /lbry/dist/lbrynet --version
CMD start

3
lbrynet/linux-x86_64-compiler/start.sh Executable file → Normal file
View file

@ -1,3 +1,2 @@
#!/bin/bash #!/bin/bash
sleep 2 echo "TODO"
cp /lbry/dist/lbrynet-x86_64.zip /target/