Skip to content

Commit c5a35bd

Browse files
committed
updating github action
1 parent 8e2e8b2 commit c5a35bd

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

.github/workflows/docker-build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ jobs:
2121
- name: Build the Docker image
2222
run: docker build . --file Dockerfile --tag mycpp_image:latest
2323

24+
# Step 2.5: Verify Docker image and cmake availability
25+
- name: Verify Docker image
26+
run: |
27+
docker run --rm mycpp_image:latest which cmake
28+
docker run --rm mycpp_image:latest which ninja
29+
docker run --rm mycpp_image:latest cmake --version
30+
docker run --rm mycpp_image:latest ninja --version
31+
2432
# Step 3: Configure CMake
2533
- name: Configure CMake
2634
run: docker run --rm -v ${{ github.workspace }}:/cpp_tutorials mycpp_image:latest cmake -S /cpp_tutorials -G "Ninja Multi-Config" -B /cpp_tutorials/build

Dockerfile

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Use Ubuntu 24.04 as the base image
2-
FROM ubuntu:24.04
1+
# Use a pre-built image with cmake and build tools to avoid package repository issues
2+
FROM ubuntu/cmake:latest
33

44
LABEL maintainer="Behnam Asadi <behnam.asadi@gmail.com>"
55

@@ -8,21 +8,17 @@ ENV DEBIAN_FRONTEND=noninteractive
88
ENV TZ=Europe/Berlin
99
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
1010

11-
# Install required packages with retry logic and better error handling
12-
RUN --mount=type=cache,target=/var/cache/apt \
13-
for i in $(seq 1 3); do \
14-
apt-get update --fix-missing && \
15-
apt-get install -y --no-install-recommends \
16-
git \
17-
cmake \
18-
ninja-build \
19-
doxygen \
20-
build-essential \
21-
graphviz \
22-
ca-certificates \
23-
&& break || sleep 10; \
24-
done && \
25-
apt-get clean && \
26-
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
11+
# Install additional required packages that aren't in the base image
12+
RUN apt-get update && apt-get install -y --no-install-recommends \
13+
doxygen \
14+
graphviz \
15+
&& apt-get clean \
16+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
17+
18+
# Verify that cmake and ninja are installed and available
19+
RUN cmake --version && ninja --version
20+
21+
# Set working directory
22+
WORKDIR /cpp_tutorials
2723

2824

0 commit comments

Comments
 (0)