From 22fd6e790ff4ecb390a91497aa27b5d936615f79 Mon Sep 17 00:00:00 2001 From: Michael Kamprath Date: Fri, 24 Feb 2023 00:39:21 -0800 Subject: [PATCH] Added a Dockerized build environment (#675) * added a dockerized build environment * addressed review comments --- .gitignore | 6 +++++- BUILDING.md | 1 + docker/Dockerfile.BK7231x_build_env | 12 ++++++++++++ docker/README.md | 23 +++++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 docker/Dockerfile.BK7231x_build_env create mode 100644 docker/README.md diff --git a/.gitignore b/.gitignore index e0c5a2611..68bffb9e5 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,8 @@ output/** .vscode node_modules Debug*/** -libs_for_simulator/** \ No newline at end of file +libs_for_simulator/** + +# MacOS ignores +.DS_Store + diff --git a/BUILDING.md b/BUILDING.md index ecf7d66a3..917c51776 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -14,6 +14,7 @@ You would need `nodejs` if you plan on making JavaScript/styling changes. This i Gulp tasks should automatically appear in Explore pane in Visual Code. They can also be invoked from console by running `gulp`. # Building +A Docker-ized build environment can be used to perform these builds. Instructions for doing so are [available here](./docker/README.md). ## Building for BK7231T diff --git a/docker/Dockerfile.BK7231x_build_env b/docker/Dockerfile.BK7231x_build_env new file mode 100644 index 000000000..36a41f25d --- /dev/null +++ b/docker/Dockerfile.BK7231x_build_env @@ -0,0 +1,12 @@ +FROM ubuntu:20.04 + +ARG DEBIAN_FRONTEND=noninteractive +ARG USERNAME=devuser + +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get install -y \ + wget git python3 python-is-python3 libc6-i386 \ + make npm + +RUN useradd -m -s /bin/bash ${USERNAME} diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..585e2eff5 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,23 @@ +# Docker Files for OpenBK7231T_App + +## Build Environment for BK7231T and BK7231N +The `Dockerfile.BK7231x_build_env` file can be used to create a consistent Linux-based environment for building OpenBK7231T_App for the `BK7231T` and `BK7231N` platforms. This allows you to build OpenBK7231T_App on any flavor of Linux and MacOS. This should also work on Windows, but is untested. + +To build the image, run from within this directory: +```sh +docker build -t openbk7231x_build --build-arg USERNAME=$USER -f Dockerfile.BK7231x_build_env . +``` + +The `cd` to the root of the `OpenBK7231T` or `OpenBK7231N` SDK repo that has been set up [as described in the build instructions](https://github.com/michaelkamprath/OpenBK7231T_App/blob/main/BUILDING.md), and then start a shell prompt in the built Docker image, that binds the SDK repo as a volume in the Docker image: + +```sh +docker run -it -v "$(pwd)/":/home/$USER/OpenBK7231T --user $USER openbk7231x_build /bin/bash +``` +Change the `OpenBK7231T` directory name in the volume mount to `OpenBK7231N` if you are building for the `OpenBK7231N` platform. + +Finally, at the Docker image's shell prompt, execute the following to build: +```sh +cd ~/OpenBK7231T/ +./b.sh +``` +Again, change the `OpenBK7231T` directory name to `OpenBK7231N` if you are building for that platform. Also, the last command may be changed to the advanced build's `build_app.sh` command as described in [the build instructions](https://github.com/michaelkamprath/OpenBK7231T_App/blob/main/BUILDING.md#building-for-bk7231t). The build results will be placed into the host computer's file system as described in the build instructions. To exit the Docker image's shell prompt when the build is done, use the `exit` command.