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: tags:
- 'ng-*' - 'ng-*'
# --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
# --build-arg VCS_REF=${GITHUB_SHA::8} \
jobs: jobs:
# build and push image to docker hub. # build and push image to docker hub.
buildx: buildx:
@ -23,45 +27,11 @@ jobs:
- -
name: Cache Docker layers name: Cache Docker layers
uses: actions/cache@v2 uses: actions/cache@v2
id: cache
with: with:
path: /tmp/.buildx-cache path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }} key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-buildx- ${{ 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 name: Login to DockerHub
uses: docker/login-action@v1 uses: docker/login-action@v1
@ -69,18 +39,17 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- -
name: Docker Buildx (push) name: Build and push
run: | uses: docker/build-push-action@v2
docker buildx build \ with:
--cache-from "type=local,src=/tmp/.buildx-cache" \ context: .
--platform ${{steps.prepare.outputs.platforms}} \ file: ./Dockerfile
--output "type=image,push=true" \ platforms: linux/amd64
--tag jonaswinkler/paperless-ng:edge ./ push: true
- tags: jonaswinkler/paperless-ng:edge
name: Docker Check Manifest cache-from: type=local,src=/tmp/.buildx-cache
run: | cache-to: type=local,dest=/tmp/.buildx-cache
docker run --rm mplatform/mquery ${{steps.prepare.outputs.tag}}
- -
name: Inspect image name: Inspect image
run: | run: |
docker buildx imagetools inspect ${{steps.prepare.outputs.tag}} docker buildx imagetools inspect jonaswinkler/paperless-ng:edge