Skip to content

Commit 34c3272

Browse files
authoredJun 13, 2022
add Dockerfile and requirements.txt, used by the Dockerfile in settin… (FreeRTOS#192)
* 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.
1 parent b313f0b commit 34c3272

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
 

‎Dockerfile

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM ubuntu:22.04
2+
3+
ENV UID=1000
4+
ENV GID=1000
5+
ENV USER=ubuntu
6+
7+
WORKDIR /tmp
8+
COPY requirements.txt .
9+
10+
SHELL ["/bin/bash", "-c"]
11+
12+
RUN apt-get clean \
13+
&& apt-get update \
14+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
15+
build-essential \
16+
clang-format cmake gcc-11 g++-11 gdb \
17+
git \
18+
lcov \
19+
libfmt-dev \
20+
libpython3-dev \
21+
libspdlog-dev \
22+
locales \
23+
ninja-build \
24+
packaging-dev \
25+
python3-pip \
26+
python3-venv \
27+
ruby \
28+
software-properties-common \
29+
tmux \
30+
uncrustify \
31+
&& pip3 install -r requirements.txt \
32+
&& wget --progress=dot:giga https://github.com/danmar/cppcheck/archive/2.6.tar.gz \
33+
&& tar xvzf 2.6.tar.gz \
34+
&& mkdir cppcheck-2.6/build \
35+
&& cd cppcheck-2.6/build \
36+
&& cmake .. -GNinja \
37+
&& ninja \
38+
&& ninja install \
39+
&& groupadd $USER -g $GID \
40+
&& adduser $USER --gid $UID --uid 1000 \
41+
&& apt-get clean \
42+
&& rm -rf /var/lib/apt/lists/* \
43+
&& locale-gen en_US.UTF-8 \
44+
&& echo "${USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
45+
46+
47+
USER $USER
48+
49+
RUN wget -qO - https://sh.rustup.rs | sh -s -- --no-modify-path -y
50+
51+
ENV PATH="/home/${USER}/.cargo/bin:${PATH}"
52+
53+
RUN rustup component add rustfmt clippy

‎README.md

+7
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ git submodule update --checkout --init --recursive test/unit-test/CMock
9191

9292
### Platform Prerequisites
9393

94+
- Docker
95+
96+
or the following:
9497
- For running unit tests
9598
- **C90 compiler** like gcc
9699
- **CMake 3.13.0 or later**
@@ -99,6 +102,10 @@ git submodule update --checkout --init --recursive test/unit-test/CMock
99102

100103
### Steps to build **Unit Tests**
101104

105+
1. If using docker, launch the container:
106+
1. `docker build -t coremqtt .`
107+
1. `docker run -it -v "$PWD":/workspaces/coreMQTT -w /workspaces/coreMQTT coremqtt`
108+
102109
1. Go to the root directory of this repository. (Make sure that the **CMock** submodule is cloned as described [above](#checkout-cmock-submodule))
103110

104111
1. Run the *cmake* command: `cmake -S test -B build`

‎requirements.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
black
2+
check-manifest
3+
cookiecutter
4+
flake8
5+
mypy
6+
nox
7+
pre-commit
8+
pybind11
9+
pylint
10+
pytest
11+
pyyaml
12+
setuptools
13+
setuptools-rust

0 commit comments

Comments
 (0)
Please sign in to comment.