From 75d016ec94e876f7ae055a1eb5845c5b6589165e Mon Sep 17 00:00:00 2001 From: GustavGroenborg Date: Wed, 16 Apr 2025 11:36:43 +0200 Subject: [PATCH 1/3] Updated dockerfile to accept build argument for version number --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 49039a5..2cb3201 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM alpine:latest +ARG VERSION="" RUN apk update && apk upgrade @@ -12,7 +13,7 @@ ADD . /service WORKDIR /service/utility -RUN ./install-oatpp-modules.sh Release +RUN ./install-oatpp-modules.sh Release $VERSION WORKDIR /service/build From 74706a84756b19247c31643ec676ff0ae758ec88 Mon Sep 17 00:00:00 2001 From: GustavGroenborg Date: Wed, 16 Apr 2025 11:37:02 +0200 Subject: [PATCH 2/3] Added possibility to clone a specific version number --- utility/install-oatpp-modules.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/utility/install-oatpp-modules.sh b/utility/install-oatpp-modules.sh index ef0ba96..3c2f3de 100755 --- a/utility/install-oatpp-modules.sh +++ b/utility/install-oatpp-modules.sh @@ -1,6 +1,7 @@ #!/bin/sh BUILD_TYPE=$1 +VERSION=$2 if [ -z "$BUILD_TYPE" ]; then BUILD_TYPE="Debug" @@ -18,15 +19,22 @@ function install_module () { BUILD_TYPE=$1 MODULE_NAME=$2 +VERSION=$3 NPROC=$(nproc) if [ -z "$NPROC" ]; then NPROC=1 fi -echo "\n\nINSTALLING MODULE '$MODULE_NAME' ($BUILD_TYPE) using $NPROC threads ...\n\n" -git clone --depth=1 https://github.com/oatpp/$MODULE_NAME +if [ -z "$3" ]; then + echo "\n\nINSTALLING MODULE '$MODULE_NAME' ($BUILD_TYPE) using $NPROC threads ...\n\n" + git clone --depth=1 https://github.com/oatpp/$MODULE_NAME +else + echo "\n\nINSTALLING MODULE '$MODULE_NAME $VERSION' ($BUILD_TYPE) using $NPROC threads ...\n\n" + git clone --depth=1 https://github.com/oatpp/$MODULE_NAME --branch $VERSION +fi + cd $MODULE_NAME mkdir build @@ -44,9 +52,9 @@ cd ../../ ########################################################## -install_module $BUILD_TYPE oatpp -install_module $BUILD_TYPE oatpp-swagger -install_module $BUILD_TYPE oatpp-sqlite +install_module $BUILD_TYPE oatpp $VERSION +install_module $BUILD_TYPE oatpp-swagger $VERSION +install_module $BUILD_TYPE oatpp-sqlite $VERSION cd ../ rm -rf tmp From be5d419278774b4b8a0894eb2826df7286ede673 Mon Sep 17 00:00:00 2001 From: GustavGroenborg Date: Wed, 16 Apr 2025 11:37:28 +0200 Subject: [PATCH 3/3] Inlcuded info about building earlier releases --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 3cd69c2..cee04ac 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,13 @@ $ docker build -t example-crud . $ docker run -p 8000:8000 -t example-crud ``` +**Note**: If you build an earlier release, you must specify the release version as an +build argument, as shown below. +``` +$ docker build -t example-crud --build-arg VERSION=1.3.0-latest . +$ docker run -p 8000:8000 -t example-crud +``` + --- ### Endpoints