mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-28 03:46:06 -05:00 
			
		
		
		
	now with cache?
This commit is contained in:
		
							
								
								
									
										87
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										87
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
								
							| @@ -14,51 +14,80 @@ jobs: | |||||||
|   buildx: |   buildx: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v2 |       - | ||||||
|       - name: Prepare |         name: Checkout | ||||||
|  |         uses: actions/checkout@v2 | ||||||
|  |       - | ||||||
|  |         name: Set up Docker Buildx | ||||||
|  |         uses: crazy-max/ghaction-docker-buildx@v3.1.0 | ||||||
|  |       - | ||||||
|  |         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 |         id: prepare | ||||||
|         env: |         env: | ||||||
|           DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }} |           DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }} | ||||||
|         # ,linux/arm/v7,linux/arm64/v8 |         # ,linux/arm/v7,linux/arm64/v8 | ||||||
|         run: | |         run: | | ||||||
|           DOCKER_PLATFORMS=linux/amd64 |           DOCKER_PLATFORMS=linux/amd64 | ||||||
|           VERSION=edge |           DOCKER_VERSION=edge | ||||||
|           if [[ $GITHUB_REF == refs/tags/* ]]; then |           if [[ $GITHUB_REF == refs/tags/* ]]; then | ||||||
|             VERSION=${GITHUB_REF#refs/tags/} |             DOCKER_VERSION=${GITHUB_REF#refs/tags/} | ||||||
|           fi |           fi | ||||||
|           if [[ $GITHUB_REF == refs/heads/* ]]; then |           if [[ $GITHUB_REF == refs/heads/* ]]; then | ||||||
|             VERSION=${GITHUB_REF#refs/heads/} |             DOCKER_VERSION=${GITHUB_REF#refs/heads/} | ||||||
|           fi |           fi | ||||||
|           TAGS="--tag ${DOCKER_IMAGE}:${VERSION}" |           DOCKER_TAG="${DOCKER_IMAGE}:${DOCKER_VERSION}" | ||||||
|           if [[ $VERSION == "master" ]]; then |           if [[ $DOCKER_VERSION == "master" ]]; then | ||||||
|             TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest" |             DOCKER_TAG="${DOCKER_IMAGE}:latest" | ||||||
|           fi |           fi | ||||||
|           echo ::set-output name=docker_image::${DOCKER_IMAGE} |           echo ::set-output name=version::${DOCKER_VERSION} | ||||||
|           echo ::set-output name=version::${VERSION} |           echo ::set-output name=platforms::${DOCKER_PLATFORMS} | ||||||
|           echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ |           echo ::set-output name=tag::${DOCKER_TAG} | ||||||
|             --build-arg VERSION=${VERSION} \ |       - | ||||||
|  |         name: Docker buildx (build) | ||||||
|  |         run: | | ||||||
|  |           docker buildx build \ | ||||||
|  |             --cache-from "type=local,src=/tmp/.buildx-cache" \ | ||||||
|  |             --cache-to "type=local,dest=/tmp/.buildx-cache" \ | ||||||
|  |             --platform ${{steps.prepare.outputs.platforms}} \ | ||||||
|  |             --output "type=image,push=false" \ | ||||||
|             --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ |             --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ | ||||||
|             --build-arg VCS_REF=${GITHUB_SHA::8} \ |             --build-arg VCS_REF=${GITHUB_SHA::8} \ | ||||||
|             ${TAGS} --file ./Dockerfile . |             --platform ${{steps.prepare.outputs.platforms}} \ | ||||||
|       - name: install buildx |             --tag ${{steps.prepare.outputs.tag}} ./ | ||||||
|         id: buildx |  | ||||||
|         uses: crazy-max/ghaction-docker-buildx@v3.1.0 |       - | ||||||
|       - name: Docker Login |         name: Login to DockerHub | ||||||
|         if: success() && github.event_name != 'pull_request' |         uses: docker/login-action@v1 | ||||||
|         env: |         with: | ||||||
|           DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} |           username: ${{ secrets.DOCKER_USERNAME }} | ||||||
|           DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |           password: ${{ secrets.DOCKER_PASSWORD }} | ||||||
|  |  | ||||||
|  |       - | ||||||
|  |         name: Docker Buildx (push) | ||||||
|         run: | |         run: | | ||||||
|           echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin |           docker buildx build \ | ||||||
|       - name: Docker Buildx (push) |             --cache-from "type=local,src=/tmp/.buildx-cache" \ | ||||||
|         if: success() && github.event_name != 'pull_request' |             --platform ${{steps.prepare.outputs.platforms}} \ | ||||||
|         run: | |             --output "type=image,push=true" \ | ||||||
|           docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} |             --tag ${{steps.prepare.outputs.tag}} ./ | ||||||
|  |  | ||||||
|       - name: Docker Check Manifest |       - name: Docker Check Manifest | ||||||
|         if: always() && github.event_name != 'pull_request' |  | ||||||
|         run: | |         run: | | ||||||
|           docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} |           docker run --rm mplatform/mquery ${{steps.prepare.outputs.tag}} | ||||||
|  |       - | ||||||
|  |         name: Inspect image | ||||||
|  |         run: | | ||||||
|  |           docker buildx imagetools inspect ${{steps.prepare.outputs.tag}} | ||||||
|  |  | ||||||
|       - name: Clear |       - name: Clear | ||||||
|         if: always() && github.event_name != 'pull_request' |  | ||||||
|         run: | |         run: | | ||||||
|           rm -f ${HOME}/.docker/config.json |           rm -f ${HOME}/.docker/config.json | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler