Skip to content

Feature/turbo simple #117

Feature/turbo simple

Feature/turbo simple #117

name: Docker – bundestag.io-dip
on:
workflow_dispatch:
push:
paths:
- 'bundestag.io/dip/**'
branches:
- 'master'
tags:
- 'bundestag.io-dip@v*'
pull_request:
paths:
- 'bundestag.io/dip/**'
branches:
- 'master'
jobs:
push:
runs-on: ubuntu-latest
environment: docker
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: democracy/bundestag.io-dip
tags: |
type=ref,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'master') || github.ref == format('refs/heads/{0}', 'alpha') || github.ref == format('refs/heads/{0}', 'internal') }}
type=ref,event=pr
type=match,asref=foo,pattern=bundestag.io-dip@v(\d+.\d+.\d+)(-alpha.\d+)?,group=1
type=semver,pattern={{version}},use=foo
type=sha,enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
with:
install: true
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-multi-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-multi-buildx
- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: bundestag.io/dip
file: infra/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
- name: Move buildx cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}