From 34c3272260024702fab7b3223acf8b957a70682a Mon Sep 17 00:00:00 2001 From: Adam Scislowicz <50060450+adam-scislowicz@users.noreply.github.com> Date: Mon, 13 Jun 2022 09:44:40 -0700 Subject: [PATCH] =?UTF-8?q?add=20Dockerfile=20and=20requirements.txt,=20us?= =?UTF-8?q?ed=20by=20the=20Dockerfile=20in=20settin=E2=80=A6=20(#192)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add Dockerfile and requirements.txt, used by the Dockerfile in setting up python dependencies. This container allows building and running of the tests and coverage report generation. * update REDME to include docker based instructions. --- Dockerfile | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 7 +++++++ requirements.txt | 13 ++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 Dockerfile create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..00a7d0715 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +FROM ubuntu:22.04 + +ENV UID=1000 +ENV GID=1000 +ENV USER=ubuntu + +WORKDIR /tmp +COPY requirements.txt . + +SHELL ["/bin/bash", "-c"] + +RUN apt-get clean \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + build-essential \ + clang-format cmake gcc-11 g++-11 gdb \ + git \ + lcov \ + libfmt-dev \ + libpython3-dev \ + libspdlog-dev \ + locales \ + ninja-build \ + packaging-dev \ + python3-pip \ + python3-venv \ + ruby \ + software-properties-common \ + tmux \ + uncrustify \ + && pip3 install -r requirements.txt \ + && wget --progress=dot:giga https://github.com/danmar/cppcheck/archive/2.6.tar.gz \ + && tar xvzf 2.6.tar.gz \ + && mkdir cppcheck-2.6/build \ + && cd cppcheck-2.6/build \ + && cmake .. -GNinja \ + && ninja \ + && ninja install \ + && groupadd $USER -g $GID \ + && adduser $USER --gid $UID --uid 1000 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && locale-gen en_US.UTF-8 \ + && echo "${USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + + +USER $USER + +RUN wget -qO - https://sh.rustup.rs | sh -s -- --no-modify-path -y + +ENV PATH="/home/${USER}/.cargo/bin:${PATH}" + +RUN rustup component add rustfmt clippy diff --git a/README.md b/README.md index ab28fd703..c6fb658e9 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,9 @@ git submodule update --checkout --init --recursive test/unit-test/CMock ### Platform Prerequisites +- Docker + +or the following: - For running unit tests - **C90 compiler** like gcc - **CMake 3.13.0 or later** @@ -99,6 +102,10 @@ git submodule update --checkout --init --recursive test/unit-test/CMock ### Steps to build **Unit Tests** +1. If using docker, launch the container: + 1. `docker build -t coremqtt .` + 1. `docker run -it -v "$PWD":/workspaces/coreMQTT -w /workspaces/coreMQTT coremqtt` + 1. Go to the root directory of this repository. (Make sure that the **CMock** submodule is cloned as described [above](#checkout-cmock-submodule)) 1. Run the *cmake* command: `cmake -S test -B build` diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..f354a8eff --- /dev/null +++ b/requirements.txt @@ -0,0 +1,13 @@ +black +check-manifest +cookiecutter +flake8 +mypy +nox +pre-commit +pybind11 +pylint +pytest +pyyaml +setuptools +setuptools-rust