Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
Update the docker build
Browse files Browse the repository at this point in the history
* Update docker-compose.yaml

* Update Dockerfile

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update Dockerfile

* Update Dockerfile

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update Dockerfile

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update Dockerfile

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update build-and-push-image.yml

* Update Dockerfile

* Update Dockerfile

* Update docker-compose.yaml

* moved to 2 different actions

* change name

* updated build and push
  • Loading branch information
bruvv authored Jun 16, 2023
1 parent 79e633b commit 879b4b0
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 29 deletions.
31 changes: 7 additions & 24 deletions .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,36 @@
name: build-and-push-image

on:
schedule:
- cron: '0 0 * * *' # Schedule to run once every day
push:
branches:
- main

env:
CURRENT_RELEASE: v0.3.1

jobs:
build-multi-arch-image:
name: Build multi-arch Docker image
runs-on: ubuntu-latest
steps:
- name: Check for new release
id: check_release
run: |
LATEST_RELEASE=$(curl -sL https://api.github.com/repos/vishen/go-chromecast/releases/latest | jq -r '.tag_name')
echo "release=$LATEST_RELEASE" >> $GITHUB_ENV
echo "CURRENT_RELEASE=${{ steps.check_release.outputs.release }}" >> $GITHUB_ENV
- name: Checkout
if: steps.check_release.outputs.release != env.CURRENT_RELEASE
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up QEMU
if: steps.check_release.outputs.release != env.CURRENT_RELEASE
uses: docker/setup-qemu-action@v1

uses: docker/[email protected]

- name: Set up Docker Buildx
if: steps.check_release.outputs.release != env.CURRENT_RELEASE
uses: docker/setup-buildx-action@v1
uses: docker/[email protected]
with:
install: true

- name: Login to GitHub Container Registry
if: steps.check_release.outputs.release != env.CURRENT_RELEASE
uses: docker/login-action@v1
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
if: steps.check_release.outputs.release != env.CURRENT_RELEASE
uses: docker/build-push-action@v2
uses: docker/[email protected]
with:
push: true
push: true
tags: ghcr.io/${{ github.repository }}:latest
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6
65 changes: 65 additions & 0 deletions .github/workflows/check_for_new_go_chromecast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Check for new Go Chromecast version

on:
schedule:
- cron: "0 0 * * *" # Schedule to run once every day

jobs:
build-multi-arch-image:
name: Build multi-arch Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get current go-chromecast version from Dockerfile
id: get-current-version
run: |
CURRENT_CHROMECASTGOVERSION=$(grep -oP '(?<=CHROMECASTGOVERSION=).*' ./Dockerfile)
echo "CURRENT_CHROMECASTGOVERSION=$CURRENT_CHROMECASTGOVERSION" >> $GITHUB_ENV
- name: Get latest go-chromecast version
id: get-latest-version
run: |
LATEST_VERSION=$(curl -s "https://api.github.com/repos/vishen/go-chromecast/releases/latest" | jq -r '.tag_name')
echo "LATEST_CHROMECASTGOVERSION=$LATEST_VERSION" >> $GITHUB_ENV
- name: Check if version is newer and update Dockerfile
id: check-version-and-update-dockerfile
run: |
if [[ "${{ env.CURRENT_CHROMECASTGOVERSION }}" == "${{ env.LATEST_CHROMECASTGOVERSION }}" ]]; then
echo "No new version available. Skipping Dockerfile update."
echo "VERSION_CHANGED=false" >> $GITHUB_ENV
else
echo "New version available. Updating Dockerfile."
echo "VERSION_CHANGED=true" >> $GITHUB_ENV
sed -i "s/ENV CHROMECASTGOVERSION=.*/ENV CHROMECASTGOVERSION=${{ env.LATEST_CHROMECASTGOVERSION }}/" ./Dockerfile
fi
- name: Set up QEMU
uses: docker/[email protected]
if: ${{ env.VERSION_CHANGED == 'true' }}

- name: Set up Docker Buildx
uses: docker/[email protected]
with:
install: true
if: ${{ env.VERSION_CHANGED == 'true' }}

- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.VERSION_CHANGED == 'true' }}

- name: Build and push
uses: docker/[email protected]
with:
push: true
context: .
tags: ghcr.io/${{ github.repository }}:latest
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6
file: ./Dockerfile
if: ${{ env.VERSION_CHANGED == 'true' }}
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ FROM alpine:latest
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ENV CHROMECASTGOVERSION=v0.3.1

RUN apk --no-cache add jq bc grep curl \
&& GC_URL=`wget https://api.github.com/repos/vishen/go-chromecast/releases/latest -O - | jq -r '.assets[].browser_download_url' | grep ${TARGETOS}_${TARGETARCH}${TARGETVARIANT}` \
&& wget $GC_URL -O /root/go-chromecast.tgz \
&& tar xzf /root/go-chromecast.tgz -C /usr/bin \
&& rm -rf /root/* \
&& chmod +x /usr/bin/go-chromecast
&& GC_URL=`wget https://api.github.com/repos/vishen/go-chromecast/releases/tags/${CHROMECASTGOVERSION} -O - | jq -r '.assets[].browser_download_url' | grep ${TARGETOS}_${TARGETARCH}${TARGETVARIANT}` \
&& wget $GC_URL -O /root/go-chromecast.tgz \
&& tar xzf /root/go-chromecast.tgz -C /usr/bin \
&& rm -rf /root/* \
&& chmod +x /usr/bin/go-chromecast

ENV SBCPOLLINTERVAL 1
ENV SBCSCANINTERVAL 300
Expand All @@ -22,3 +23,4 @@ LABEL Description="Container to run go-chromecast with some preset ENVs, run as
ADD sponsorblockcast.sh /usr/bin/sponsorblockcast

CMD /usr/bin/sponsorblockcast

5 changes: 5 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ services:
cap_add:
- NET_ADMIN
restart: always
healthcheck:
test: ["CMD", "go-chromecast", "ls"]
interval: 60s
timeout: 10s
retries: 3

0 comments on commit 879b4b0

Please sign in to comment.