Skip to content

Commit

Permalink
build: update upstream docker image build py script to support config…
Browse files Browse the repository at this point in the history
…urable main branch
  • Loading branch information
josedev-union committed Jun 6, 2024
1 parent db48bcf commit ed5e21c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
env:
DOCKERHUB_USER: ${{ secrets.CR_USERNAME }}
DOCKERHUB_REPO: ${{ secrets.CR_ENDPOINT }}/ortege/studio
MAIN_BRANCH: ortege
run: |
pip install click
./scripts/build_docker.py ${{ matrix.build_preset }} ${{ github.event_name }} --platform ${{ matrix.platform }}
5 changes: 3 additions & 2 deletions scripts/build_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
CACHE_REPO = f"{REPO}-cache"
BASE_PY_IMAGE = "3.9-slim-bookworm"

MAIN_BRANCH = os.getenv("MAIN_BRANCH", "master")

def run_cmd(command: str, raise_on_failure: bool = True) -> str:
process = subprocess.Popen(
Expand Down Expand Up @@ -124,8 +125,8 @@ def get_docker_tags(
if is_latest or force_latest:
# add a latest tag
tags.add(make_docker_tag(["latest"] + tag_chunks))
elif build_context == "push" and build_context_ref == "master":
tags.add(make_docker_tag(["master"] + tag_chunks))
elif build_context == "push" and build_context_ref == MAIN_BRANCH:
tags.add(make_docker_tag([MAIN_BRANCH] + tag_chunks))
elif build_context == "pull_request":
tags.add(make_docker_tag([f"pr-{build_context_ref}"] + tag_chunks))
return tags
Expand Down

0 comments on commit ed5e21c

Please sign in to comment.