Update Docker workflow (#62)
This commit is contained in:
parent
230e7276e2
commit
d082dc71be
|
@ -6,7 +6,7 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
tags:
|
tags:
|
||||||
- "v*.*.*"
|
- 'v*.*.*'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**/*.md'
|
- '**/*.md'
|
||||||
- '.gitignore'
|
- '.gitignore'
|
||||||
|
@ -65,7 +65,6 @@ jobs:
|
||||||
type=sha,suffix=-${{ env.SUFFIX }},enable=${{ !startsWith(github.ref, 'refs/tags/') }}
|
type=sha,suffix=-${{ env.SUFFIX }},enable=${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
|
||||||
- name: Docker - Set tags output
|
- name: Docker - Set tags output
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
id: tags
|
id: tags
|
||||||
run: |
|
run: |
|
||||||
if [[ '${{ matrix.target.os }}' == 'linux' && '${{ matrix.target.arch }}' == 'amd64' ]]; then
|
if [[ '${{ matrix.target.os }}' == 'linux' && '${{ matrix.target.arch }}' == 'amd64' ]]; then
|
||||||
|
@ -75,40 +74,12 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Docker - Login to Docker Hub
|
- name: Docker - Login to Docker Hub
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Docker - Build and export to Docker
|
- name: Docker - Build and Push
|
||||||
id: build
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ${{ env.DOCKER_FILE }}
|
|
||||||
platforms: ${{ env.PLATFORM }}
|
|
||||||
load: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|
||||||
- name: Docker - Minify image
|
|
||||||
uses: kitabisa/docker-slim-action@v1
|
|
||||||
id: slim
|
|
||||||
env:
|
|
||||||
DSLIM_HTTP_PROBE: false
|
|
||||||
with:
|
|
||||||
target: ${{ steps.meta.outputs.tags }}
|
|
||||||
overwrite: true
|
|
||||||
|
|
||||||
- name: Docker - Show slim report
|
|
||||||
run: echo "${REPORT}" | jq -r
|
|
||||||
env:
|
|
||||||
REPORT: ${{ steps.slim.outputs.report }}
|
|
||||||
|
|
||||||
- name: Docker - Push to Docker registry
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
id: push
|
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
@ -121,7 +92,6 @@ jobs:
|
||||||
# Publish single image
|
# Publish single image
|
||||||
publish:
|
publish:
|
||||||
name: Push single image
|
name: Push single image
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
|
@ -152,4 +122,3 @@ jobs:
|
||||||
inputs: ${{ env.TAGS }}
|
inputs: ${{ env.TAGS }}
|
||||||
images: ${{ needs.build.outputs.tags-linux-amd64 }},${{ needs.build.outputs.tags-linux-arm64 }}
|
images: ${{ needs.build.outputs.tags-linux-amd64 }},${{ needs.build.outputs.tags-linux-arm64 }}
|
||||||
push: true
|
push: true
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue