Merge pull request #32 from nicolabs/dockerhub

Create dockerhub.yml
This commit is contained in:
nicobo 2020-12-20 23:01:57 +01:00 committed by GitHub
commit 2dce1880d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

44
.github/workflows/dockerhub.yml vendored Normal file
View file

@ -0,0 +1,44 @@
# Just followed https://docs.docker.com/ci-cd/github-actions/
#
name: Build and publish to Docker Hub
on:
push:
branches: [master]
# Environment variables available to all jobs and steps in this workflow
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
jobs:
build-publish:
name: Build, Publish
runs-on: ubuntu-latest
steps:
# Download and Install IBM Cloud CLI
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ DOCKER_HUB_USERNAME }}
password: ${{ DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
# Build the Docker image
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile-alpine
push: true
tags: nicobot:dev
# Push the image to IBM Container Registry
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}