Skip to content

chore: update Dockerfile to use Go 1.23.4 and enhance build logging #920

chore: update Dockerfile to use Go 1.23.4 and enhance build logging

chore: update Dockerfile to use Go 1.23.4 and enhance build logging #920

Workflow file for this run

name: Build docker image
# Add concurrency configuration to handle multiple pushes
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
schedule:
# Runs at 02:00 UTC every day
- cron: '0 2 * * *'
pull_request:
workflow_dispatch:
push:
branches:
# Only run on push to main branch
- main
jobs:
wait-for-quiet-period:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Wait for quiet period
run: sleep 3600 # Wait for 1 hour
golangci:
needs: [wait-for-quiet-period]
uses: ./.github/workflows/golangci-lint.yml
test-docker-image:
needs: [wait-for-quiet-period, golangci]
# Ubuntu-20.04 required until this is fixed: https://github.com/actions/runner-images/discussions/9074
runs-on: ubuntu-20.04
steps:
- name: Checkout GitHub Action
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build amd64 image for testing
uses: docker/build-push-action@v6
with:
context: .
tags: birdnet-go:test
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Install alsa dummy module for testing built image
run: |
sudo apt-get install linux-modules-extra-$(uname -r)
sudo modprobe snd-dummy
- name: Test built amd64 image
run: |
docker run --rm -p 8080:8080 --device /dev/snd --env ALSA_CARD=0 birdnet-go:test realtime --source "Dummy" & p1=$!
if ! wget --retry-connrefused --waitretry=1 --tries=5 -q -O /dev/null http://localhost:8080; then
echo "Failed to reach container after 5 sec"
kill "$p1"
exit 1
else
echo "Container responded to request"
kill "$p1"
fi
push-docker-image:
needs: test-docker-image
if: github.event_name == 'push' && github.ref_name == 'main'
runs-on: ubuntu-20.04
steps:
- name: Checkout GitHub Action
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate downcase repository name
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ env.REPO }}:dev
ghcr.io/${{ env.REPO }}:${{ github.sha }}
platforms: linux/arm64, linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false