Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build latest docker container from master not develop branch #161

Merged
merged 6 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 33 additions & 6 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
name: Update docker image

on:
workflow_dispatch: # Trigger by hand from the UI
workflow_dispatch: # Trigger by hand from the UI
inputs:
branch:
type: choice
description: branch to build the container from
options:
- develop
- master
push:
branches:
- develop
- master

jobs:
build-and-release-docker-image:
Expand All @@ -13,10 +21,28 @@ jobs:
env:
docker_username: precice
steps:
- name: Get branch name
if: github.event_name != 'pull_request'
- name: Set branch name for manual triggering
if: github.event_name == 'workflow_dispatch'
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
run: |
echo "ADAPTER_REF=${{ inputs.branch }}" >> $GITHUB_ENV
- name: Set branch name for on pull triggering
if: github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch'
shell: bash
run: |
echo "ADAPTER_REF=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Set PYTHON_BINDINGS_REF and the TAG depending on branch
shell: bash
run: |
if [[ '${{ env.ADAPTER_REF }}' == 'master' ]]; then
echo "PYTHON_BINDINGS_REF=latest" >> "$GITHUB_ENV"
echo "TAG=latest" >> "$GITHUB_ENV"
echo "Building TAG: latest"
else
echo "PYTHON_BINDINGS_REF=${{ env.ADAPTER_REF }}" >> "$GITHUB_ENV"
echo "TAG=${{ env.ADAPTER_REF }}" >> "$GITHUB_ENV"
echo "Building TAG: ${{ env.ADAPTER_REF }}"
fi
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
Expand All @@ -31,6 +57,7 @@ jobs:
with:
push: true
file: "./tools/releasing/packaging/docker/Dockerfile"
tags: ${{ env.docker_username }}/fenics-adapter:${{ env.branch }},${{ env.docker_username }}/fenics-adapter:latest
tags: ${{ env.docker_username }}/fenics-adapter:${{ env.TAG }}
build-args: |
branch=${{ env.branch }}
FENICS_ADAPTER_REF=${{ env.ADAPTER_REF }}
PYTHON_BINDINGS_REF=${{ env.PYTHON_BINDINGS_REF }}
8 changes: 4 additions & 4 deletions tools/releasing/packaging/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dockerfile to build a ubuntu image containing the installed Debian package of a release
ARG branch=develop
ARG from=precice/python-bindings:${branch}
ARG PYTHON_BINDINGS_REF=develop
ARG from=precice/python-bindings:${PYTHON_BINDINGS_REF}
FROM $from

USER root
Expand All @@ -17,7 +17,7 @@ RUN python3 -m pip install --user --upgrade pip

# Rebuild image if force_rebuild after that command
ARG CACHEBUST
ARG branch=develop
ARG FENICS_ADAPTER_REF=develop

# Building fenics-adapter
RUN python3 -m pip install --user git+https://github.com/precice/fenics-adapter.git@$branch
RUN python3 -m pip install --user git+https://github.com/precice/fenics-adapter.git@$FENICS_ADAPTER_REF
Loading