nicobot/.github/workflows/dockerhub.yml
nicobo b75b4c536f
Create dockerhub.yml
Github Action to build & push image to docker hub
2020-12-20 22:59:58 +01:00

45 lines
1.1 KiB
YAML

# 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 }}