From 54468a8047a7e9e369141d2c9dad6f688dbb0ace Mon Sep 17 00:00:00 2001 From: Oisin Date: Mon, 7 Oct 2024 18:52:16 +0100 Subject: [PATCH 1/3] Passing git branch parameter to docker image build --- exeDocker.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exeDocker.bat b/exeDocker.bat index 2b684f1..8d2f553 100644 --- a/exeDocker.bat +++ b/exeDocker.bat @@ -4,12 +4,13 @@ SET DOCKER_REPO=randomtelecompayments SET DOCKER_TAG=latest SET DOCKER_IMAGE=%DOCKER_USER%/%DOCKER_REPO%:%DOCKER_TAG% SET DOCKER_CONTAINER_NAME=rtp +SET GIT_BRANCH=v0.0.0 :: remove existing docker containers and images docker image rm -f %DOCKER_IMAGE% :: build docker image -call docker build --no-cache -t %DOCKER_IMAGE% . +call docker build --no-cache -t %DOCKER_IMAGE% . --build-arg GIT_BRANCH=%GIT_BRANCH% :: run docker container SET UBUNTU_DIR=/home/ubuntu From 6de95139f4d25178d69a65984d06607b0657ffe8 Mon Sep 17 00:00:00 2001 From: Oisin Date: Mon, 7 Oct 2024 18:54:03 +0100 Subject: [PATCH 2/3] #19 parameterised git branch --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9eb6cf0..e09cab8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,9 @@ FROM ubuntu:20.04 # set environment variables ENV user=ubuntu ENV DEBIAN_FRONTEND=noninteractive +# set git branch for cloning +ARG GIT_BRANCH +ENV GIT_BRANCH=${GIT_BRANCH} # install required software and programmes for development environment RUN apt-get update @@ -14,7 +17,7 @@ RUN useradd ${user} RUN mkdir -p /home/${user} && chown -R ${user}: /home/${user} # clone git repo -RUN git clone https://github.com/oislen/RandomTelecomPayments.git --branch randomtelecompayments_dev_1.0 /home/ubuntu/RandomTelecomPayments +RUN git clone https://github.com/oislen/RandomTelecomPayments.git --branch ${GIT_BRANCH} /home/ubuntu/RandomTelecomPayments # install required python packages COPY requirements.txt /tmp/ From 44d46e2c02476d7db7e2e936a481fd7ead6e3974 Mon Sep 17 00:00:00 2001 From: Oisin Date: Mon, 7 Oct 2024 18:54:40 +0100 Subject: [PATCH 3/3] 19 passing main as git branch when building docker image --- .github/workflows/dockerhub-main-push.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dockerhub-main-push.yml b/.github/workflows/dockerhub-main-push.yml index bed4d7b..a032044 100644 --- a/.github/workflows/dockerhub-main-push.yml +++ b/.github/workflows/dockerhub-main-push.yml @@ -23,4 +23,5 @@ jobs: uses: docker/build-push-action@v6 with: push: true - tags: oislen/randomtelecompayments:latest \ No newline at end of file + tags: oislen/randomtelecompayments:latest + build-args: GIT_BRANCH=main \ No newline at end of file