Skip to content

Merge pull request #2503 from onaio/soft-delete-xform-in-legacy-ui #320

Merge pull request #2503 from onaio/soft-delete-xform-in-legacy-ui

Merge pull request #2503 from onaio/soft-delete-xform-in-legacy-ui #320

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