2019-04-25 16:15:14 +02:00
|
|
|
## Compiler for lbrynet container for any architecture supported by Ubuntu 18.04
|
|
|
|
## Specify the BASE_IMAGE build argument to choose which Ubuntu base image to build from.
|
|
|
|
## Docs for ARG in FROM: https://github.com/docker/cli/blob/master/docs/reference/builder.md#understand-how-arg-and-from-interact
|
|
|
|
## Architecture | Build command
|
|
|
|
## x86_64 | docker build -t lbrynet -f Dockerfile-compiler .
|
|
|
|
## armhf | docker build -t lbrynet-armhf -f Dockerfile-compiler --build-arg BASE_IMAGE=multiarch/ubuntu-core:armhf-bionic .
|
|
|
|
## arm64 | docker build -t lbrynet-arm64 -f Dockerfile-compiler --build-arg BASE_IMAGE=multiarch/ubuntu-core:arm64-bionic .
|
|
|
|
|
|
|
|
ARG BASE_IMAGE=ubuntu:18.04
|
|
|
|
FROM ${BASE_IMAGE} as dependencies
|
2019-04-23 22:33:24 +02:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y \
|
|
|
|
python3-pip \
|
|
|
|
python3.7 \
|
|
|
|
python3.7-dev \
|
|
|
|
build-essential \
|
|
|
|
libssl-dev \
|
|
|
|
libacl1-dev \
|
|
|
|
liblz4-dev \
|
|
|
|
libfuse-dev \
|
|
|
|
fuse \
|
|
|
|
pkg-config \
|
|
|
|
fakeroot \
|
|
|
|
git \
|
|
|
|
zlib1g-dev \
|
|
|
|
libbz2-dev \
|
|
|
|
libncurses5-dev \
|
|
|
|
libreadline-dev \
|
|
|
|
liblzma-dev \
|
|
|
|
libsqlite3-dev \
|
|
|
|
zip \
|
|
|
|
libffi-dev \
|
|
|
|
libleveldb-dev && \
|
|
|
|
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 --config python && \
|
|
|
|
python --version && \
|
|
|
|
pip3 --version
|
|
|
|
|
|
|
|
FROM dependencies as compile
|
|
|
|
|
2019-05-01 18:09:13 +02:00
|
|
|
ARG REPO=https://github.com/lbryio/lbry.git
|
2019-04-27 22:44:12 +02:00
|
|
|
ARG VERSION=master
|
2019-06-27 17:04:40 +02:00
|
|
|
ARG RUN_FROM_SOURCE=false
|
2019-04-23 22:33:24 +02:00
|
|
|
RUN python3.7 -m pip install -U pyinstaller && \
|
2019-06-27 17:04:40 +02:00
|
|
|
git clone ${REPO} /lbry-sdk && \
|
|
|
|
git -C /lbry-sdk checkout ${VERSION}
|
|
|
|
RUN python3.7 -m pip install -e /lbry-sdk/torba
|
|
|
|
WORKDIR /lbry-sdk/lbry
|
2019-04-25 14:06:38 +02:00
|
|
|
COPY stuff/start.sh /usr/local/bin/start
|
|
|
|
COPY stuff/checkmount.sh /usr/local/bin/checkmount
|
2019-05-30 22:16:37 +02:00
|
|
|
RUN export TRAVIS_COMMIT=`git rev-parse HEAD` && \
|
|
|
|
python3.7 scripts/set_build.py && \
|
2019-04-23 22:33:24 +02:00
|
|
|
python3.7 -m pip install -e . && \
|
2019-06-27 17:04:40 +02:00
|
|
|
pyinstaller -F -n lbrynet lbry/extras/cli.py && \
|
|
|
|
chmod +x /lbry-sdk/lbry/dist/lbrynet && \
|
2019-04-25 14:06:38 +02:00
|
|
|
chmod a+x /usr/local/bin/* && \
|
2019-06-27 17:04:40 +02:00
|
|
|
/lbry-sdk/lbry/dist/lbrynet --version
|
2019-04-23 22:33:24 +02:00
|
|
|
|
2019-04-25 16:15:14 +02:00
|
|
|
FROM ${BASE_IMAGE} as app
|
2019-04-23 22:33:24 +02:00
|
|
|
RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet
|
2019-06-27 17:04:40 +02:00
|
|
|
COPY --from=compile /usr/local/bin/start /usr/local/bin/checkmount /lbry-sdk/lbry/dist/lbrynet /usr/local/bin/
|
2019-04-23 22:33:24 +02:00
|
|
|
EXPOSE 5279
|
|
|
|
USER lbrynet
|
2019-04-25 14:06:38 +02:00
|
|
|
ENTRYPOINT ["/usr/local/bin/checkmount"]
|
2019-04-23 22:33:24 +02:00
|
|
|
CMD ["start"]
|