v4.0.0 #372
Workflow file for this run
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
name: Docker Build Image | |
on: | |
release: | |
types: | |
- "released" | |
push: | |
branches: | |
- "main" | |
workflow_dispatch: | |
jobs: | |
main: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Get the version | |
id: get-version | |
if: github.event_name != 'push' && github.event_name != 'workflow_dispatch' | |
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Get the branch name | |
id: get-branch-name | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
run: echo "version=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./docker/onadata-uwsgi/Dockerfile.ubuntu | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
optional_packages=PyYAML django-redis | |
push: true | |
tags: | | |
onaio/onadata:${{ env.version || github.ref_name }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |