update github action for main image

This commit is contained in:
Alberto 2021-06-22 11:01:21 +02:00
parent ebab3b49d1
commit f89ba22435
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2

View File

@ -1,17 +1,53 @@
name: Docker Images CI
on:
push:
branches: [ main ]
branches: dev
jobs:
build:
buildx:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: '1'
steps:
- uses: actions/checkout@v2
- name: Build the Unified Docker image
run: docker build . --file Dockerfile --tag albertoxamin/bang:latest
- name: Log into registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push images
run: docker push albertoxamin/bang:latest
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v3
-
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: Docker Buildx (build)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/amd64,linux/arm/v7,linux/arm64 \
--output "type=image,push=false" \
--tag albertoxamin/bang:latest \
--file ./Dockerfile ./
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
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 linux/amd64,linux/arm/v7,linux/arm64 \
--output "type=image,push=true" \
--tag albertoxamin/bang:latest \
--file ./Dockerfile ./
-
name: Inspect image
run: |
docker buildx imagetools inspect albertoxamin/bang:latest