From b9cae416ecd4d2cc534fe4f0c5e6b3ec8debb681 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Sat, 22 Mar 2025 16:40:11 -0500 Subject: [PATCH] Use dev branch for dev builds. --- .github/workflows/docker-build.yml | 8 ++++++-- docker/Dockerfile | 5 ++++- docker/build-dev.sh | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 7883ea86..46f7ee8b 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -27,13 +27,15 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Determine image tag - id: set-tag + - name: Determine image tag and branch + id: set-tag-branch run: | if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then echo "TAG=latest" >> $GITHUB_ENV + echo "BRANCH=main" >> $GITHUB_ENV elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then echo "TAG=dev" >> $GITHUB_ENV + echo "BRANCH=dev" >> $GITHUB_ENV fi - name: Convert repository name to lowercase @@ -46,6 +48,8 @@ jobs: file: docker/Dockerfile push: true platforms: linux/amd64,linux/arm64 + build-args: | + BRANCH=${{ env.BRANCH }} tags: | ghcr.io/${{ env.REPO_NAME }}:${{ env.TAG }} ghcr.io/${{ env.REPO_NAME }}:${{ github.sha }} diff --git a/docker/Dockerfile b/docker/Dockerfile index be4ce21b..b833a9f7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,8 @@ FROM python:3.13-slim AS builder +# Define build argument with default value of "main" +ARG BRANCH=main + ENV PATH="/dispatcharrpy/bin:$PATH" \ VIRTUAL_ENV=/dispatcharrpy \ DJANGO_SETTINGS_MODULE=dispatcharr.settings \ @@ -24,7 +27,7 @@ RUN apt-get update && \ nodejs && \ python -m pip install virtualenv && \ virtualenv /dispatcharrpy && \ - git clone https://github.com/Dispatcharr/Dispatcharr /app && \ + git clone -b ${BRANCH} https://github.com/Dispatcharr/Dispatcharr /app && \ cd /app && \ rm -rf .git && \ cd /app && \ diff --git a/docker/build-dev.sh b/docker/build-dev.sh index 0b723671..c5c79474 100755 --- a/docker/build-dev.sh +++ b/docker/build-dev.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker build -t dispatcharr/dispatcharr:dev -f Dockerfile .. +docker build --build-arg BRANCH=dev -t dispatcharr/dispatcharr:dev -f Dockerfile ..