simplify some things

This commit is contained in:
jonaswinkler 2021-01-09 19:50:11 +01:00
parent d7095f7ee1
commit 4363d4c9ed

View File

@ -9,6 +9,10 @@ on:
tags:
- 'ng-*'
# --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
# --build-arg VCS_REF=${GITHUB_SHA::8} \
jobs:
# build and push image to docker hub.
buildx:
@ -23,45 +27,11 @@ jobs:
-
name: Cache Docker layers
uses: actions/cache@v2
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Prepare
id: prepare
env:
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}
run: |
DOCKER_PLATFORMS=linux/amd64
DOCKER_VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
DOCKER_VERSION=${GITHUB_REF#refs/tags/}
fi
if [[ $GITHUB_REF == refs/heads/* ]]; then
DOCKER_VERSION=${GITHUB_REF#refs/heads/}
fi
DOCKER_TAG="jonaswinkler/paperless-ng-test:${DOCKER_VERSION}"
if [[ $DOCKER_VERSION == "master" ]]; then
DOCKER_TAG="jonaswinkler/paperless-ng-test:latest"
fi
echo ::set-output name=version::${DOCKER_VERSION}
echo ::set-output name=platforms::${DOCKER_PLATFORMS}
echo ::set-output name=tag::${DOCKER_TAG}
-
name: Docker buildx (build)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--output "type=image,push=false" \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--build-arg VCS_REF=${GITHUB_SHA::8} \
--platform ${{steps.prepare.outputs.platforms}} \
--tag jonaswinkler/paperless-ng:edge ./
-
name: Login to DockerHub
uses: docker/login-action@v1
@ -69,18 +39,17 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Docker Buildx (push)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--platform ${{steps.prepare.outputs.platforms}} \
--output "type=image,push=true" \
--tag jonaswinkler/paperless-ng:edge ./
-
name: Docker Check Manifest
run: |
docker run --rm mplatform/mquery ${{steps.prepare.outputs.tag}}
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: jonaswinkler/paperless-ng:edge
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
-
name: Inspect image
run: |
docker buildx imagetools inspect ${{steps.prepare.outputs.tag}}
docker buildx imagetools inspect jonaswinkler/paperless-ng:edge