Skip to content

Resolve minor build related issues #415

Resolve minor build related issues

Resolve minor build related issues #415

name: Build/Push docker image
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# This is what will cancel the workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: sumeetchhetri/ffead-cpp-base
JAVA_IMAGE_NAME: sumeetchhetri/ffead-cpp-java-base
IMG_VERSION: "7.0"
jobs:
push:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '[docker_push]')
steps:
- uses: actions/checkout@v2
- name: Build base ffead-cpp image
run: |
cd docker/te
docker build . --file ffead-cpp-base.dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push base ffead-cpp image
run: |
IMAGE_ID=$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
#[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `$IMG_VERSION` tag convention
[ "$VERSION" == "master" ] && VERSION=$IMG_VERSION
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION