From 837aedd6d65bc0c9a435d791b259b5eb0013d308 Mon Sep 17 00:00:00 2001 From: Rachel Colquhoun Date: Wed, 30 Apr 2025 10:26:02 +0100 Subject: [PATCH 1/3] enable correct versioning in docker image --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index aa11928..aff346f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ COPY src /charon/src COPY include /charon/include COPY cmake /charon/cmake COPY lib /charon/lib +COPY .git /charon/.git COPY CMakeLists.txt version.h.in /charon WORKDIR /charon/build From e8cbe6aad8d32ee485bd689f25f57996e7134a0e Mon Sep 17 00:00:00 2001 From: Rachel Colquhoun Date: Wed, 30 Apr 2025 10:41:54 +0100 Subject: [PATCH 2/3] Update docker_push.yml add a conditional argument to docker build if dev branch --- .github/workflows/docker_push.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docker_push.yml b/.github/workflows/docker_push.yml index fda2ff8..d486f5e 100644 --- a/.github/workflows/docker_push.yml +++ b/.github/workflows/docker_push.yml @@ -28,6 +28,10 @@ jobs: uses: actions/checkout@v2 - name: Build new docker image + if: ${{ github.event_name == 'push' }} + run: docker build --no-cache . -t rmcolq/charon:latest --build-arg is_dev="True" + - name: Build new docker image + if: ${{ github.event_name == 'release' }} run: docker build --no-cache . -t rmcolq/charon:latest - name: Push Docker image to DockerHub (dev) From 862d2a7cbf59de8f2d8fc4840187b881ffdcd4f5 Mon Sep 17 00:00:00 2001 From: Rachel Colquhoun Date: Wed, 30 Apr 2025 10:43:27 +0100 Subject: [PATCH 3/3] add build argument to dockerfile if dev branch so can clone directly from github and get versioning --- Dockerfile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index aff346f..1fde26f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM ubuntu:24.04 +ARG is_dev + RUN apt update RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ gcc-14 g++-14 \ @@ -11,13 +13,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ RUN update-alternatives --install /usr/bin/g++ g++ /bin/g++-14 14 RUN update-alternatives --install /usr/bin/gcc gcc /bin/gcc-14 14 -RUN mkdir -p /charon -COPY src /charon/src -COPY include /charon/include -COPY cmake /charon/cmake -COPY lib /charon/lib -COPY .git /charon/.git -COPY CMakeLists.txt version.h.in /charon +WORKDIR / +RUN if [[ -z "$is_dev" ]] ; then git clone -b dev https://github.com/rmcolq/charon.git; else git clone https://github.com/rmcolq/charon.git; fi WORKDIR /charon/build RUN cmake -DCMAKE_BUILD_TYPE=RELEASE .. > cmake.log