Update dev-image.yml

This commit is contained in:
Alberto Xamin 2021-06-21 17:24:11 +02:00 committed by GitHub
parent 9d412e35ee
commit 1edf0d72ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,56 +1,53 @@
name: Docker Images CI name: Docker Images CI
on: on:
push: push:
branches: [ dev ] branches: dev
jobs: jobs:
docker: buildx:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout -
name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
-
- name: Prepare name: Set up Docker Buildx
id: prep uses: crazy-max/ghaction-docker-buildx@v3
run: | -
DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPOSITORY#*/} name: Cache Docker layers
VERSION=latest uses: actions/cache@v2
SHORTREF=${GITHUB_SHA::8} id: cache
TAGS="${DOCKER_IMAGE}:dev,${DOCKER_IMAGE}:${SHORTREF}"
# If the VERSION looks like a version number, assume that
# this is the most recent version of the image and also
# tag it 'latest'.
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
# Set output parameters.
echo ::set-output name=tags::${TAGS}
echo ::set-output name=docker_image::${DOCKER_IMAGE}
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with: with:
platforms: all path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
- name: Set up Docker Buildx restore-keys: |
id: buildx ${{ runner.os }}-buildx-
uses: docker/setup-buildx-action@master -
name: Docker Buildx (build)
- name: Login to DockerHub run: |
if: github.event_name != 'pull_request' docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/386,linux/amd64,linux/arm/v7,linux/arm64 \
--output "type=image,push=false" \
--tag albertoxamin/bang:dev \
--file ./Dockerfile-diun ./
-
name: Login to DockerHub
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
-
- name: Build name: Docker Buildx (push)
uses: docker/build-push-action@v2 run: |
with: docker buildx build \
builder: ${{ steps.buildx.outputs.name }} --cache-from "type=local,src=/tmp/.buildx-cache" \
context: . --platform linux/386,linux/amd64,linux/arm/v7,linux/arm64 \
file: ./Dockerfile --output "type=image,push=true" \
platforms: linux/amd64,linux/arm64 --tag albertoxamin/bang:dev \
push: true --file ./Dockerfile-diun ./
tags: ${{ steps.prep.outputs.tags }} -
name: Inspect image
run: |
docker buildx imagetools inspect albertoxamin/bang:dev