Skip to content

Commit

Permalink
ci: updated container tag name depending on node and debian
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbourianes-kalisio committed Jul 18, 2024
1 parent 8dbe03f commit 26ee242
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ jobs:
name: Build app
if: ${{ !contains(github.event.head_commit.message, 'skip app') }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
node: [ 20 ]
debian: [ 'bookworm' ]
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand All @@ -20,4 +25,4 @@ jobs:
- name: Build app
env:
SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }}
run: bash ./scripts/build_app.sh -p -r ${{ github.job }} -n 20 -d bookworm
run: bash ./scripts/build_app.sh -p -r ${{ github.job }} -n ${{ matrix.node }} -d ${{ matrix.debian }}
14 changes: 9 additions & 5 deletions scripts/build_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ WORKSPACE_DIR="$(dirname "$ROOT_DIR")"
## Parse options
##

NODE_VER=20
DEBIAN_VER=bookworm
DEFAULT_NODE_VER=20
DEFAULT_DEBIAN_VER=bookworm
NODE_VER=$DEFAULT_NODE_VER
DEBIAN_VER=$DEFAULT_DEBIAN_VER
PUBLISH=false
CI_STEP_NAME="Build app"
while getopts "pr:" option; do
Expand Down Expand Up @@ -61,7 +63,7 @@ cp "$KLI_FILE" "$WORKSPACE_DIR/kli.js"
echo "Will use kli file $KLI_FILE to install and link modules ..."

IMAGE_NAME="$KALISIO_DOCKERHUB_URL/kalisio/$APP"
IMAGE_TAG="$VERSION-$FLAVOR"
IMAGE_TAG="$VERSION-$FLAVOR-node$NODE_VER-$DEBIAN_VER"

begin_group "Building container $IMAGE_NAME:$IMAGE_TAG ..."

Expand All @@ -76,11 +78,13 @@ DOCKER_BUILDKIT=1 docker build \
-f app.Dockerfile \
-t "$IMAGE_NAME:$IMAGE_TAG" \
"$WORKSPACE_DIR"
docker tag "$IMAGE_NAME:$IMAGE_TAG" "$IMAGE_NAME:$FLAVOR"

if [ "$PUBLISH" = true ]; then
docker push "$IMAGE_NAME:$IMAGE_TAG"
docker push "$IMAGE_NAME:$FLAVOR"
if [ "$NODE_VER" = "$DEFAULT_NODE_VER" ] && [ "$DEBIAN_VER" = "$DEFAULT_DEBIAN_VER" ]; then
docker tag "$IMAGE_NAME:$IMAGE_TAG" "$IMAGE_NAME:$FLAVOR"
docker push "$IMAGE_NAME:$FLAVOR"
fi
fi

docker logout "$KALISIO_DOCKERHUB_URL"
Expand Down

0 comments on commit 26ee242

Please sign in to comment.