First try at making non root compatible #216
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: | |
push: | |
paths: | |
- 'docker/**' | |
- 'version.json' | |
branches: ['main'] | |
pull_request: | |
paths: | |
- 'docker/**' | |
- 'version.json' | |
workflow_dispatch: | |
jobs: | |
docker-build: | |
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: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Login to Container Registry | |
if: github.event_name != 'pull_request' | |
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: ${{ github.event_name != 'pull_request' }} | |
provenance: false | |
tags: | | |
deconzcommunity/deconz:latest | |
deconzcommunity/deconz:${{ steps.version.outputs.prop }} | |
deconzcommunity/deconz:${{ steps.channel.outputs.prop }} | |
ghcr.io/${{ github.repository }}:latest | |
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.prop }} | |
ghcr.io/${{ github.repository }}:${{ steps.channel.outputs.prop }} | |
labels: | | |
maintainer=${{ github.repository_owner }} | |
org.opencontainers.image.vendor=${{ github.repository_owner }} | |
org.opencontainers.image.revision=${{ github.sha }} |