add docker build

First passing build with a container. The `Dockerfile` contains
a current set of build dependencies to install on Unbuntu Server 22.04
as of the time of this commit
This commit is contained in:
Val Orekhov 2023-06-05 16:54:16 -04:00
parent 2e55c044ca
commit 902db2a368
2 changed files with 46 additions and 0 deletions

28
Dockerfile Normal file
View File

@ -0,0 +1,28 @@
FROM ubuntu:22.04
ARG UNAME=build
ARG UID=1000
ARG GID=1000
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \
apt-get install -y \
sudo time git make curl wget subversion build-essential gcc file bc cpio gawk flex gettext unzip grep rsync pkg-config \
openssl libssl-dev libncurses5-dev zlib1g-dev libwayland-dev libkf5config-dev-bin libkf5coreaddons-dev-bin \
python3 python3-distutils \
qttools5-dev qttools5-dev-tools qtdeclarative5-dev && \
apt-get clean
VOLUME ["/ccache"]
VOLUME ["/downloads"]
VOLUME ["/src"]
ENV BR2_DL_DIR="/downloads"
ENV BR2_CCACHE_DIR="/ccache"
RUN groupadd -g $GID -o $UNAME && useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
USER $UNAME
WORKDIR /src
CMD ["/bin/bash"]

View File

@ -51,6 +51,24 @@ The following system packages are required to build the image:
- wget
- qtdeclarative5-dev
#### Docker Build Environment
To build the build environment run the following from the root folder of the project:
```sh
docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t buildroot-agent .
```
To execute a build, run the following, replacing <MAKE_ARG> with an argument to be passed in to `make`, such as `clean` or `rpi4_64-gui`
```sh
docker run -v ./:/src -v ./ccache/:/ccache -v ../downloads/:/downloads --entrypoint /usr/bin/make -e BR2_JLEVEL=$(nproc) buildroot <MAKE_ARG>
```
Adjust paths to the `/ccache` and `/downloads` volumes accordingly. If these are not passed in, the caches will reside inside the container file system.
On `podman`, the Dockerfile has been configured to run as a user with the same uid/gid as the current user (passed in as a build-arg).
This will require passing the --userns=keep-id argument, e.g.:
```sh
podman run --userns=keep-id -v ./:/src -v ./ccache/:/ccache -v ../downloads/:/downloads --entrypoint /usr/bin/make -e BR2_JLEVEL=$(nproc) buildroot clean
```
#### The following firewall ports need to be allowed to the internet.
In addition to the usual http/https ports (tcp 80, tcp 443) a couple of other ports need to be allowed to the internet :
- tcp 9418 (git).