feat: Github actions to deploy docker images

This commit is contained in:
SamTolmay 2021-06-08 16:12:30 +02:00
parent db4b7f9028
commit de49159af2

66
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,66 @@
name: Release
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
steps:
- uses: actions/checkout@v2
- 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: Docker meta
# id: meta
# uses: docker/metadata-action@v3
# with:
# images: ${{ secrets.DOCKER_HUB_USERNAME }}/lowdefy:latest
# tags: |
# type=semver,pattern={{version}}
# type=semver,pattern={{major}}.{{minor}}
# type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./packages/servers/serverDocker/
# file: ./packages/servers/serverDocker/Dockerfile
push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/lowdefy:latest
platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move 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 }}