Skip to content
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: 32 additions & 7 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
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 image from
options:
- develop
- master
push:
branches:
- develop
- master


jobs:
build-and-release-docker-image:
Expand All @@ -13,10 +22,26 @@ 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 "BINDINGS_REF=${{ inputs.branch }}" >> $GITHUB_ENV
- name: Set branch name for "on pull request" triggering
if: github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch'
shell: bash
run: echo "BINDINGS_REF=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Set PRECICE_TAG and the TAG depending on branch
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
run: |
if [[ '${{ env.BINDINGS_REF }}' == 'master' ]]; then
echo "PRECICE_TAG=latest" >> "$GITHUB_ENV"
echo "TAG=latest" >> "$GITHUB_ENV"
echo "Building TAG: latest"
else
echo "PRECICE_TAG=${{ env.BINDINGS_REF }}" >> "$GITHUB_ENV"
echo "TAG=${{ env.BINDINGS_REF }}" >> "$GITHUB_ENV"
echo "Building TAG: ${{ env.BINDINGS_REF }}"
fi
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
Expand All @@ -31,7 +56,7 @@ jobs:
with:
push: true
file: "./tools/releasing/packaging/docker/Dockerfile"
tags: ${{ env.docker_username }}/python-bindings:${{ env.branch }},${{ env.docker_username }}/python-bindings:latest
tags: ${{ env.docker_username }}/python-bindings:${{ env.TAG }}
build-args: |
branch=${{ env.branch }}
from=precice/precice:develop
PRECICE_TAG=${{ env.PRECICE_TAG }}
PYTHON_BINDINGS_REF=${{ env.BINDINGS_REF }}
9 changes: 4 additions & 5 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/precice:latest
ARG PRECICE_TAG=develop
ARG from=precice/precice:${PRECICE_TAG}
FROM $from

USER root
Expand Down Expand Up @@ -42,8 +42,7 @@ SHELL ["/bin/bash", "-c"]
RUN python3 -m pip install --user --upgrade pip

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

# Builds the precice python bindings for python3
RUN pip3 install --user git+https://github.com/precice/python-bindings.git@$branch
RUN pip3 install --user git+https://github.com/precice/python-bindings.git@${PYTHON_BINDINGS_REF}