Skip to content

Commit 8b7f122

Browse files
shamitha-shashidharamarcmo
authored andcommitted
CI: Add Dockerfiles for dev and docs
Add Docker Compose file Add README.md for Dockerfiles Signed-off-by: Shamitha Shashidhara <[email protected]>
1 parent 52d6af6 commit 8b7f122

File tree

4 files changed

+123
-0
lines changed

4 files changed

+123
-0
lines changed

docker/Dockerfile.dev

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM ubuntu:22.04
2+
3+
RUN apt-get update && apt-get install -y \
4+
python3.10 \
5+
python3-pip \
6+
bzip2\
7+
tar \
8+
clang-tidy \
9+
wget \
10+
curl \
11+
git \
12+
gcc-11 \
13+
g++-11\
14+
lcov\
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.22.5/cmake-3.22.5-linux-x86_64.sh \
18+
&& chmod +x cmake-3.22.5-linux-x86_64.sh \
19+
&& ./cmake-3.22.5-linux-x86_64.sh --skip-license --prefix=/usr/local \
20+
&& rm cmake-3.22.5-linux-x86_64.sh
21+
22+
RUN wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 \
23+
&& tar -xjf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 -C /usr/local \
24+
&& rm gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 \
25+
&& ln -s /usr/local/gcc-arm-none-eabi-10.3-2021.10/bin/* /usr/local/bin/
26+
27+
RUN mkdir -p /root/.local/bin
28+
29+
RUN curl -L https://github.com/numtide/treefmt/releases/download/v2.1.0/treefmt_2.1.0_linux_amd64.tar.gz -o treefmt.tar.gz \
30+
&& tar -xvzf treefmt.tar.gz \
31+
&& install -m 755 treefmt /root/.local/bin/treefmt \
32+
&& rm LICENSE README.md treefmt treefmt.tar.gz
33+
34+
RUN curl -L https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-32d3ac78/clang-format-17_linux-amd64 -o /root/.local/bin/clang-format && \
35+
chmod +x /root/.local/bin/clang-format
36+
37+
ENV PATH="/root/.local/bin:$PATH"
38+
39+
RUN pip3 install cmakelang
40+
41+
RUN echo 'export HISTFILE=/root/.bash_history/history' >> /root/.bashrc

docker/Dockerfile.docs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM ubuntu:22.04
2+
3+
RUN apt-get update && apt-get install -y python3.10 python3-pip openjdk-11-jdk graphviz \
4+
doxygen\
5+
wget \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
COPY ../doc/requirements.txt .
9+
10+
RUN pip3 install --no-cache-dir -r requirements.txt
11+
12+
RUN wget https://sourceforge.net/projects/plantuml/files/plantuml.jar/download -O /usr/local/bin/plantuml.jar \
13+
&& echo '#!/bin/sh\njava -jar /usr/local/bin/plantuml.jar "$@"' > /usr/local/bin/plantuml && \
14+
chmod +x /usr/local/bin/plantuml
15+
16+
RUN pip3 install coverxygen
17+
18+
RUN echo 'export HISTFILE=/root/.bash_history/history' >> /root/.bashrc

docker/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Docker Information
2+
3+
Developer Dockerfile can be used to set up the development environment.
4+
It includes all the necessary tools, libraries, and dependencies required
5+
for development. This ensures that all developers work in a consistent
6+
environment, reducing the "it works on my machine" problem.
7+
Documentation Dockerfile is used to build project's documentation.
8+
9+
Project uses Docker Compose to manage both the Developer Dockerfile and the
10+
Documentation Dockerfile. Docker Compose simplifies the process of building
11+
and running multiple Docker containers, ensuring that both the development
12+
environment and the documentation container are consistently set up and managed.
13+
14+
## Build the docker image
15+
16+
If you have docker compose installed, you can use this command
17+
18+
docker-compose -f docker/docker-compose.yaml build
19+
20+
If you do not want to use docker compose, you can use this command instead
21+
22+
docker build -f docker/<dockerfile_name> -t <image_name> .
23+
24+
This will build the image from the Dockerfile in the current directory (the `.`).
25+
26+
## Run the docker container
27+
28+
If you have docker compose installed, the easiest way is to call
29+
30+
docker compose -f docker/docker-compose.yaml run <service_name>
31+
32+
If you do not want to use docker compose, you can use this command instead
33+
34+
docker run -it --rm -v $PWD:$PWD --workdir $PWD <image_name>
35+
36+
This command creates the docker container and enters it (`-it` for interactive).
37+
The container will be removed when you leave it again (`--rm`).
38+
Your current directory is mounted into the container. This is set up as the working
39+
directory in the container (`-v $PWD:$PWD --workdir $PWD`).

docker/docker-compose.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: '3'
2+
services:
3+
dev:
4+
build:
5+
context: ..
6+
dockerfile: docker/Dockerfile.dev
7+
working_dir:
8+
/usr/src
9+
volumes:
10+
- ..:/usr/src
11+
- ../.docker_history:/root/.bash_history
12+
command: /bin/bash
13+
tty: true
14+
15+
docs:
16+
build:
17+
context: ..
18+
dockerfile: docker/Dockerfile.docs
19+
working_dir:
20+
/usr/src
21+
volumes:
22+
- ..:/usr/src
23+
- ../.docker_history:/root/.bash_history
24+
command: /bin/bash
25+
tty: true

0 commit comments

Comments
 (0)