-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7673ae
commit 6a8724d
Showing
18 changed files
with
213 additions
and
73 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Docker Image Builder | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
platform: | ||
description: 'The platform to build the image for' | ||
required: true | ||
type: string | ||
path: | ||
description: 'The path to the build context' | ||
required: false | ||
default: . | ||
type: string | ||
file: | ||
description: 'The path to the Dockerfile' | ||
required: false | ||
default: ./Dockerfile | ||
type: string | ||
build-args: | ||
description: 'Build args to be passed to Docker build' | ||
required: false | ||
default: '' | ||
type: string | ||
images: | ||
description: 'The images to pass to the Docker metadata action' | ||
required: true | ||
type: string | ||
tags: | ||
description: 'The tags to pass to the Docker metadata action' | ||
required: true | ||
type: string | ||
flavor: | ||
description: 'The flavor to pass to the Docker metadata action' | ||
required: false | ||
default: '' | ||
type: string | ||
outputs: | ||
tag: | ||
description: 'The first tag generated by Docker for this build' | ||
value: ${{ jobs.build-image.outputs.tag }} | ||
secrets: | ||
DOCKERHUB_TOKEN: | ||
description: 'The token used to access Docker hub' | ||
required: false | ||
|
||
jobs: | ||
build-image: | ||
name: Build Docker image | ||
runs-on: ubuntu-latest | ||
env: | ||
docker-token: ${{ secrets.DOCKERHUB_TOKEN }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ inputs.images }} | ||
tags: ${{ inputs.tags }} | ||
flavor: ${{ inputs.flavor }} | ||
- name: Get first tag | ||
id: first-tag | ||
run: | | ||
echo -e ${{ toJson(steps.meta.outputs.tags) }} | { mapfile -t; echo "tag=${MAPFILE[0]}" >> $GITHUB_OUTPUT; echo "First tag: ${MAPFILE[0]}"; } | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
if: env.docker-token != '' | ||
with: | ||
username: ${{ vars.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
if: contains( inputs.images, 'ghcr.io' ) | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
config-inline: | | ||
[worker.oci] | ||
max-parallelism = 2 | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: ${{ inputs.build-args }} | ||
file: ${{ inputs.file }} | ||
context: ${{ inputs.path }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: ${{ inputs.platform }} | ||
outputs: | ||
tag: ${{ steps.first-tag.outputs.tag }} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Docker CI | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
tags: [ "v*.*.*" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
|
||
enumerate-configs: | ||
name: Enumerate configs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- id: set-matrix | ||
name: Generate matrix with all configured Dockerfiles | ||
run: | | ||
echo "matrix=$(ls -l config/Dockerfile.* | grep '^-' | awk -F ' ' '{print $9}' | { read x; echo "${x##*.}"; } | jq -R -s -c 'split("\n") | map(select(length > 0))')" >> $GITHUB_OUTPUT | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
|
||
build-base-image: | ||
name: Build base image | ||
needs: enumerate-configs | ||
uses: ./.github/workflows/build-docker-image.yml | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: ${{ fromJson(vars.DOCKER_PLATFORMS) }} | ||
with: | ||
platform: ${{ matrix.platform }} | ||
images: | | ||
name=ngreatorex/homie-streamdeck,enable=${{ github.event_name != 'pull_request' }} | ||
name=ghcr.io/${{ github.actor }}/homie-streamdeck,enable=${{ github.event_name == 'pull_request' }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
secrets: inherit | ||
|
||
build-configured-images: | ||
name: Build configured images | ||
#if: github.event_name != 'pull_request' | ||
needs: | ||
- enumerate-configs | ||
- build-base-image | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: ${{ fromJson(vars.DOCKER_PLATFORMS) }} | ||
config-name: ${{ fromJson(needs.enumerate-configs.outputs.matrix) }} | ||
uses: ./.github/workflows/build-docker-image.yml | ||
with: | ||
build-args: | | ||
FROM_IMAGE=${{ needs.build-base-image.outputs.tag }} | ||
images: | | ||
name=ghcr.io/${{ github.actor }}/homie-streamdeck-configured | ||
flavor: | | ||
suffix=_${{ matrix.config-name }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
platform: ${{ matrix.platform }} | ||
path: config/ | ||
file: config/Dockerfile.${{ matrix.config-name }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
node_modules/ | ||
config.json | ||
/config.json | ||
/*.png |
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ARG FROM_IMAGE=ngreatorex/homie-streamdeck:master | ||
FROM $FROM_IMAGE | ||
|
||
COPY config.json /app/ | ||
COPY images /app/images/ | ||
|
||
WORKDIR /app | ||
RUN ln -s images/Main_Off.png 0.png | ||
RUN ln -s images/Uplight_Off.png 1.png | ||
RUN ln -s images/Porch_Off.png 2.png | ||
RUN ln -s images/Main_On.png 3.png | ||
RUN ln -s images/Uplight_On.png 4.png | ||
RUN ln -s images/Porch_On.png 5.png |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ARG FROM_IMAGE=ngreatorex/homie-streamdeck:master | ||
FROM $FROM_IMAGE | ||
|
||
COPY config.json /app/ | ||
COPY images /app/images/ | ||
|
||
WORKDIR /app | ||
RUN ln -s images/Main_Off.png 0.png | ||
RUN ln -s images/Uplight_Off.png 1.png | ||
RUN ln -s images/Bedroom_Off.png 2.png | ||
RUN ln -s images/Bedside_Off.png 3.png | ||
RUN ln -s images/Porch_Off.png 4.png | ||
RUN ln -s images/Main_On.png 5.png | ||
RUN ln -s images/Uplight_On.png 6.png | ||
RUN ln -s images/Bedroom_On.png 7.png | ||
RUN ln -s images/Bedside_On.png 8.png | ||
RUN ln -s images/Porch_On.png 9.png | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"mqtt_host": "mqtt.lan" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.