Skip to content

Commit

Permalink
add docker ci
Browse files Browse the repository at this point in the history
  • Loading branch information
bennsimon committed Apr 22, 2021
1 parent fa04c85 commit ec2bf37
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/docker-publish.yml
@@ -0,0 +1,83 @@
name: Docker

on:
push:
# Publish `master` as Docker `master` tag.
# See also https://github.com/crazy-max/ghaction-docker-meta#basic
branches:
- master

# Publish `v1.2.3` tags as releases.
tags:
- v*

pull_request:
# Run Tests when changes are made to the Docker file
paths:
- 'Dockerfile'

workflow_dispatch:
inputs:
customTag:
description: "Includes the specified tag to docker image tags"
required: false

jobs:
# Run image build test
test:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Run Build tests
run: docker build . --file Dockerfile

push:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: opensrp/web
tag-custom: ${{ github.event.inputs.customTag }}

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Push to Docker Image Repositories
uses: docker/build-push-action@v2
id: docker_build
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit ec2bf37

Please sign in to comment.