github action to docker build and push

This commit is contained in:
Mário Lima 2021-10-10 23:38:59 +01:00
parent c22a6e08ea
commit 5967e8c7c8
No known key found for this signature in database
GPG Key ID: CAC35FE47AF46787

43
.github/workflows/docker-publish.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: Docker
on:
push:
branches:
- dev-rpi-docker
tags:
- v*
# Run tests for any PRs.
pull_request:
env:
PLATFORM: linux/arm/v7
IMAGE_NAME: dizquetv:arm7
jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Build and Push image
run: |
docker buildx build --platform "${{PLATFORM}}" --tag $IMAGE_NAME --file ./Dockerfile-rpi --output type=image,push=true .