Skip to content

Merge pull request #1034 from opengisch/sql_migrate #645

Merge pull request #1034 from opengisch/sql_migrate

Merge pull request #1034 from opengisch/sql_migrate #645

name: Build and Push
on:
push:
branches:
- master
tags:
- "v*.*.*"
jobs:
build_and_push:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
id: prepare
run: |
TAG="latest"
COMMIT="commit-$(git rev-parse --short ${{ github.sha }})"
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/v}
fi
echo "docker_tag=${TAG}" >> $GITHUB_OUTPUT
echo "docker_commit=${COMMIT}" >> $GITHUB_OUTPUT
git submodule update --init --recursive --depth 1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- 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: Login to dockerhub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# Application
- name: Docker Test Application
id: docker_test_application
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-app
file: ./docker-app/Dockerfile
- name: Docker Build and Push Application
id: docker_build_and_push_application
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
target: webserver_runtime
context: ./docker-app
file: ./docker-app/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
opengisch/qfieldcloud-app:${{ steps.prepare.outputs.docker_tag }}
opengisch/qfieldcloud-app:${{ steps.prepare.outputs.docker_commit }}
- name: Docker Build and Push Worker
id: docker_build_and_push_worker
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
target: worker_wrapper_runtime
context: ./docker-app
file: ./docker-app/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.docker_tag }}
opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.docker_commit }}
# QGIS
- name: Docker Test QGIS
id: docker_test_qgis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-qgis
file: ./docker-qgis/Dockerfile
- name: Docker Build and Push QGIS
id: docker_build_and_push_qgis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-qgis
file: ./docker-qgis/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.docker_tag }}
opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.docker_commit }}
# Nginx
- name: Docker Build and Push nginx
id: docker_build_and_push_nginx
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-nginx
file: ./docker-nginx/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
opengisch/qfieldcloud-nginx:${{ steps.prepare.outputs.docker_tag }}
opengisch/qfieldcloud-nginx:${{ steps.prepare.outputs.docker_commit }}