First try at making non root compatible #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build and push image | |
on: | |
pull_request: | |
types: [ labeled ] | |
paths: | |
- 'docker/**' | |
- 'version.json' | |
workflow_dispatch: | |
jobs: | |
docker-build: | |
if: ${{ github.event.label.name == 'Development-Image' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- name: standard | |
dockerfile: docker/Dockerfile | |
platforms: |- | |
linux/amd64 | |
linux/arm/v7 | |
linux/arm64 | |
image_name: "docker-deconz" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.platforms }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.platforms }} | |
${{ runner.os }}-buildx- | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Login to Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: get version | |
id: version | |
uses: notiz-dev/github-action-json-property@release | |
with: | |
path: 'version.json' | |
prop_path: 'version' | |
- name: get channel | |
id: channel | |
uses: notiz-dev/github-action-json-property@release | |
with: | |
path: 'version.json' | |
prop_path: 'channel' | |
- name: Build and push ${{ matrix.name }} | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./docker/ | |
file: ${{ matrix.dockerfile }} | |
platforms: ${{ matrix.platforms }} | |
build-args: | | |
VERSION=${{ steps.version.outputs.prop }} | |
CHANNEL=${{ steps.channel.outputs.prop }} | |
push: true | |
tags: | | |
deconzcommunity/deconz:development | |
ghcr.io/${{ github.repository }}:development | |
labels: | | |
maintainer=${{ github.repository_owner }} | |
org.opencontainers.image.vendor=${{ github.repository_owner }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache |