Skip to content

#35 implemented; also removed reg_cred_secret because no longer needed #27

#35 implemented; also removed reg_cred_secret because no longer needed

#35 implemented; also removed reg_cred_secret because no longer needed #27

Workflow file for this run

name: CI/CD for Gateway
on:
push:
branches: [ none ] # [ main ]
# pull_request_review:
# types: [ submitted ]
# branches: [ main ] # [ none ]
pull_request:
types: [ closed ]
branches: [ main ] # [ none ]
workflow_dispatch: # Allows for manual dispatching
env:
DOCKER_ACCOUNT: curtisab
DOCKER_PROJECT: gateway
jobs:
build-push-container:
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
# - name: Set tag as branch name
# run: echo "DOCKER_TAG=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
- name: Set tag as pull request branch
run: echo "DOCKER_TAG=$(echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV
- name: Check tag
run: echo $DOCKER_TAG
- name: Login to DockerHub Registry
run : echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Docker build with version and latest tags
run: |
docker build . --file Dockerfile --tag $DOCKER_ACCOUNT/$DOCKER_PROJECT:latest --tag $DOCKER_ACCOUNT/$DOCKER_PROJECT:$DOCKER_TAG
- name: Docker push with version and latest tags
run: |
docker image push --all-tags $DOCKER_ACCOUNT/$DOCKER_PROJECT