-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from docknetwork/ci/docker-hub-build
added Github build action for Docker Hub
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Docker Container Build | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
image_tag: | ||
type: string | ||
description: The tag to apply to the built container image | ||
required: true | ||
default: latest | ||
|
||
release: | ||
types: | ||
- published | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-docker-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Set tag name | ||
id: image_tag | ||
shell: bash | ||
run: | | ||
export TAG_NAME=docknetwork/dock-did-driver:build-${{github.run_number}} | ||
if [ "${{ github.event.inputs.image_tag}}" != "" ]; | ||
then | ||
export TAG_NAME=docknetwork/dock-did-driver:${{github.event.inputs.image_tag}} | ||
fi | ||
if [ "${{ github.event_name}}" == "release" ]; | ||
then | ||
export TAG_NAME='docknetwork/dock-did-driver:latest' | ||
fi | ||
echo "Trigger: ${{github.event_name}} TAG_NAME: $TAG_NAME" | ||
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT | ||
- name: 'Build production ${{ steps.image_tag.outputs.TAG_NAME }} image' | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
push: true | ||
tags: ${{ steps.image_tag.outputs.TAG_NAME }} | ||
|