Skip to content

Commit

Permalink
Merges lbrynet compilers into one Dockerfile with ARG for BASE_IMAGE
Browse files Browse the repository at this point in the history
EnigmaCurry committed Apr 27, 2019
1 parent c3accd7 commit 44f8f86
Showing 3 changed files with 30 additions and 65 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
FROM multiarch/ubuntu-core:armhf-bionic as dependencies
## 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
RUN apt-get update && \
apt-get install -y \
python3-pip \
@@ -48,7 +57,7 @@ RUN python3.7 scripts/set_build.py && \
mkdir /target && \
/lbry/dist/lbrynet --version

FROM multiarch/ubuntu-core:armhf-bionic as app
FROM ${BASE_IMAGE} as app
RUN adduser lbrynet --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbrynet
COPY --from=compile /usr/local/bin/start /usr/local/bin/checkmount /lbry/dist/lbrynet /usr/local/bin/
EXPOSE 5279
57 changes: 0 additions & 57 deletions lbrynet/Dockerfile-x86_64-compiler

This file was deleted.

25 changes: 19 additions & 6 deletions lbrynet/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
# lbrynet

## Compiler containers
## Compiler container

The compiler containers are for building lbrynet for multiple architectures.
The [Dockerfile-compiler-linux](Dockerfile-compiler-linux) is for building lbrynet for any architecture supported
by an Ubuntu 18.04 base image.

### Build x86 compiler container
### Register qemu to run docker images built for platforms other than your host

```
docker build -t lbrynet-x86_64 -f Dockerfile-x86_64-compiler .
docker run --rm --privileged multiarch/qemu-user-static:register
```

### Build ARM compiler container
### Build for the default x86_64 platform:

```
docker build -t lbrynet-armhf -f Dockerfile-armhf-compiler .
docker build -t lbrynet -f Dockerfile-compiler-linux .
```

### Build for an ARM 32-bit platform:

```
docker build -t lbrynet-armhf -f Dockerfile-compiler-linux --build-arg BASE_IMAGE=multiarch/ubuntu-core:armhf-bionic .
```

### Build for an ARM 64-bit platform:

```
docker build -t lbrynet-arm64 -f Dockerfile-compiler-linux --build-arg BASE_IMAGE=multiarch/ubuntu-core:arm64-bionic .
```

0 comments on commit 44f8f86

Please sign in to comment.