Skip to content

Adds support for building earlier releases using docker #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM alpine:latest
ARG VERSION=""

RUN apk update && apk upgrade

Expand All @@ -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

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 13 additions & 5 deletions utility/install-oatpp-modules.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

BUILD_TYPE=$1
VERSION=$2

if [ -z "$BUILD_TYPE" ]; then
BUILD_TYPE="Debug"
Expand All @@ -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
Expand All @@ -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