From 82b3f11007a3e004e2badd222ebcc2bec0c0f727 Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Tue, 29 Oct 2024 16:05:24 +0100 Subject: [PATCH 1/4] Use explicit versions when building docker images --- .env | 1 + demo/.env | 1 + demo/Dockerfile | 3 ++- demo/docker-compose.yaml | 10 ++++++++-- docker-compose.yaml | 5 +++-- version | 1 + 6 files changed, 16 insertions(+), 5 deletions(-) create mode 120000 .env create mode 120000 demo/.env create mode 100644 version diff --git a/.env b/.env new file mode 120000 index 00000000..ca291e96 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +version \ No newline at end of file diff --git a/demo/.env b/demo/.env new file mode 120000 index 00000000..4a82335f --- /dev/null +++ b/demo/.env @@ -0,0 +1 @@ +../.env \ No newline at end of file diff --git a/demo/Dockerfile b/demo/Dockerfile index c91db76e..2ff5378e 100644 --- a/demo/Dockerfile +++ b/demo/Dockerfile @@ -1,4 +1,5 @@ -FROM ghcr.io/kit-mrt/arbitration_graphs:latest AS tutorial +ARG VERSION +FROM ghcr.io/kit-mrt/arbitration_graphs:$VERSION AS tutorial USER root diff --git a/demo/docker-compose.yaml b/demo/docker-compose.yaml index 6f259731..5dcb68e1 100644 --- a/demo/docker-compose.yaml +++ b/demo/docker-compose.yaml @@ -1,9 +1,12 @@ services: tutorial: + image: ghcr.io/kit-mrt/arbitration_graphs_pacman_tutorial:$VERSION build: context: . + args: + - VERSION=$VERSION target: tutorial - image: arbitration_graphs_pacman_tutorial + env_file: .env volumes: - .:/home/blinky/demo - $HOME/.Xauthority:/home/blinky/.Xauthority @@ -12,10 +15,13 @@ services: - DISPLAY=$DISPLAY demo: + image: ghcr.io/kit-mrt/arbitration_graphs_pacman_demo:$VERSION build: context: . + args: + - VERSION=$VERSION target: demo - image: arbitration_graphs_pacman_demo + env_file: .env volumes: - $HOME/.Xauthority:/home/blinky/.Xauthority - /tmp/.X11-unix:/tmp/.X11-unix diff --git a/docker-compose.yaml b/docker-compose.yaml index 2224e4b6..7df020f1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,5 @@ services: arbitration_graphs: - image: arbitration_graphs - build: . \ No newline at end of file + image: ghcr.io/kit-mrt/arbitration_graphs:$VERSION + build: . + env_file: .env diff --git a/version b/version new file mode 100644 index 00000000..9939df2c --- /dev/null +++ b/version @@ -0,0 +1 @@ +VERSION=v0.0.1 \ No newline at end of file From bdd22a4f70f32b9344501d08bf4a1202adfd5883 Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Tue, 29 Oct 2024 16:06:49 +0100 Subject: [PATCH 2/4] Merge docker-compose.yaml with docker-compose.devel.yaml --- README.md | 4 ++-- docker-compose.devel.yaml | 8 -------- docker-compose.yaml | 6 ++++++ 3 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 docker-compose.devel.yaml diff --git a/README.md b/README.md index 4a51aa3d..2f59e6cc 100644 --- a/README.md +++ b/README.md @@ -75,8 +75,8 @@ Follow the steps above to setup the Docker image. Then, run the development image. ```bash -docker compose -f docker-compose.devel.yaml build -docker compose -f docker-compose.devel.yaml run --rm arbitration_graphs_devel +docker compose build +docker compose run --rm arbitration_graphs_devel ``` This mounts the source into the container's `/home/blinky/arbitration_graphs` folder. diff --git a/docker-compose.devel.yaml b/docker-compose.devel.yaml deleted file mode 100644 index a7200ba9..00000000 --- a/docker-compose.devel.yaml +++ /dev/null @@ -1,8 +0,0 @@ -services: - arbitration_graphs_devel: - extends: - file: docker-compose.yaml - service: arbitration_graphs - image: arbitration_graphs_devel - volumes: - - .:/home/blinky/arbitration_graphs \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 7df020f1..32e507e7 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,3 +3,9 @@ services: image: ghcr.io/kit-mrt/arbitration_graphs:$VERSION build: . env_file: .env + arbitration_graphs_devel: + extends: + service: arbitration_graphs + image: arbitration_graphs_devel + volumes: + - .:/home/blinky/arbitration_graphs From ffdc8f6907931f0c7c0d944d282677cb31c5beb5 Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Tue, 29 Oct 2024 16:07:12 +0100 Subject: [PATCH 3/4] Build demo with more threads --- demo/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/Dockerfile b/demo/Dockerfile index 2ff5378e..a3e949cc 100644 --- a/demo/Dockerfile +++ b/demo/Dockerfile @@ -34,7 +34,7 @@ COPY --chown=blinky:blinky CMakeLists.txt /home/blinky/demo/CMakeLists.txt WORKDIR /home/blinky/demo/build RUN cmake -DCMAKE_BUILD_TYPE=Release .. && \ - cmake --build . + cmake --build . -j8 CMD [ "/home/blinky/demo/build/arbitration_graphs_pacman_demo_exe" ] From 68c648d098d09f21e38b916e7fdef6086986a0f9 Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Mon, 28 Oct 2024 18:15:46 +0100 Subject: [PATCH 4/4] Avoid copying the whole repo into the docker image --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 769499f4..f3bf2b32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,11 @@ RUN git clone https://github.com/KIT-MRT/util_caching.git /tmp/util_caching && \ # Install arbitration_graphs -COPY . /tmp/arbitration_graphs +COPY CMakeLists.txt /tmp/arbitration_graphs/ +COPY cmake /tmp/arbitration_graphs/cmake +COPY include /tmp/arbitration_graphs/include +COPY test /tmp/arbitration_graphs/test + RUN mkdir /tmp/arbitration_graphs/build && \ cd /tmp/arbitration_graphs/build && \ cmake .. && \