Skip to content

Commit

Permalink
CI: update Docker image build logic
Browse files Browse the repository at this point in the history
- Change development image tags to "development" so that branch name and tag name are the same
  (and we don't need any logic to translate between branch names and tag names)
- Also build images for release-1.9 branch
- Also re-build images if their build workflow changes
  • Loading branch information
stsnel committed Feb 29, 2024
1 parent 2782c67 commit a0c09d1
Show file tree
Hide file tree
Showing 29 changed files with 155 additions and 42 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build-push-image-davrods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-davrods.yml'
- 'docker/images/davrods/**'

jobs:
Expand All @@ -16,6 +18,11 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
Expand All @@ -36,4 +43,6 @@ jobs:
context: yoda/docker/images/davrods
file: yoda/docker/images/davrods/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/davrods:dev-1.9
tags: ghcr.io/utrechtuniversity/davrods:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
11 changes: 10 additions & 1 deletion .github/workflows/build-push-image-eus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-eus.yml'
- 'docker/images/yoda_eus/**'

jobs:
Expand All @@ -16,6 +18,11 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
Expand All @@ -36,4 +43,6 @@ jobs:
context: yoda/docker/images/yoda_eus
file: yoda/docker/images/yoda_eus/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/yoda-eus:dev-1.9
tags: ghcr.io/utrechtuniversity/yoda-eus:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
11 changes: 9 additions & 2 deletions .github/workflows/build-push-image-mailpit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-mailpit.yml'
- 'docker/images/mailpit/**'

jobs:
Expand All @@ -16,6 +18,11 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
Expand All @@ -36,5 +43,5 @@ jobs:
- name: Build and push Docker image
run: |
cd yoda/docker/images/mailpit
./build.sh
docker push ghcr.io/utrechtuniversity/yoda-mailpit:dev-1.9
./build.sh "${{ steps.extract_branch.outputs.branch }}"
docker push ghcr.io/utrechtuniversity/yoda-mailpit:${{ steps.extract_branch.outputs.branch }}
11 changes: 10 additions & 1 deletion .github/workflows/build-push-image-portal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-portal.yml'
- 'docker/images/yoda_portal/**'

jobs:
Expand All @@ -16,6 +18,11 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
Expand All @@ -36,4 +43,6 @@ jobs:
context: yoda/docker/images/yoda_portal
file: yoda/docker/images/yoda_portal/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/yoda-portal:dev-1.9
tags: ghcr.io/utrechtuniversity/yoda-portal:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
12 changes: 11 additions & 1 deletion .github/workflows/build-push-image-provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-provider.yml'
- 'docker/images/yoda_irods_icat/**'
- 'roles/irods_completion/files/irods_completion.sh'
- 'roles/pam_python/files/pam_python.so'
Expand All @@ -19,6 +21,11 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
Expand All @@ -44,4 +51,7 @@ jobs:
context: yoda/docker/images/yoda_irods_icat
file: yoda/docker/images/yoda_irods_icat/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/yoda-provider:dev-1.9
tags: ghcr.io/utrechtuniversity/yoda-provider:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
12 changes: 11 additions & 1 deletion .github/workflows/build-push-image-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-public.yml'
- 'docker/images/yoda_public/**'
- 'roles/yoda_landingpages/files/**'

Expand All @@ -17,6 +19,11 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
Expand All @@ -42,4 +49,7 @@ jobs:
context: yoda/docker/images/yoda_public
file: yoda/docker/images/yoda_public/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/yoda-public:dev-1.9
tags: ghcr.io/utrechtuniversity/yoda-public:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
12 changes: 11 additions & 1 deletion .github/workflows/build-push-image-web-mock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-web-mock.yml'
- 'docker/images/yoda_web_mock/**'

jobs:
Expand All @@ -16,6 +18,11 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
Expand All @@ -36,4 +43,7 @@ jobs:
context: yoda/docker/images/yoda_web_mock
file: yoda/docker/images/yoda_web_mock/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/yoda-web-mock:dev-1.9
tags: ghcr.io/utrechtuniversity/yoda-web-mock:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
14 changes: 7 additions & 7 deletions docker/compose-with-bind-mounts/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
container_name: provider.yoda
platform: linux/amd64
hostname: provider.yoda
image: ghcr.io/utrechtuniversity/yoda-provider:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-provider:development
ports:
- "8247:1247"
- "20000-20199:20000-20199"
Expand Down Expand Up @@ -62,7 +62,7 @@ services:
container_name: portal.yoda
platform: linux/amd64
hostname: portal.yoda
image: ghcr.io/utrechtuniversity/yoda-portal:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-portal:development
depends_on:
- provider
- eus
Expand All @@ -80,7 +80,7 @@ services:
container_name: eus.yoda
platform: linux/amd64
hostname: eus.yoda
image: ghcr.io/utrechtuniversity/yoda-eus:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-eus:development
depends_on:
- extuserdb
- mailpit
Expand All @@ -101,7 +101,7 @@ services:
container_name: public.yoda
platform: linux/amd64
hostname: public.yoda
image: ghcr.io/utrechtuniversity/yoda-public:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-public:development
ports:
- "8446:443"
build:
Expand All @@ -118,7 +118,7 @@ services:
container_name: data.yoda
platform: linux/amd64
hostname: data.yoda
image: ghcr.io/utrechtuniversity/davrods:dev-1.9
image: ghcr.io/utrechtuniversity/davrods:development
depends_on:
- provider
ports:
Expand All @@ -131,7 +131,7 @@ services:
container_name: mailpit.yoda
platform: linux/amd64
hostname: mailpit.yoda
image: ghcr.io/utrechtuniversity/yoda-mailpit:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-mailpit:development
environment:
- TZ=Europe/Amsterdam
build:
Expand All @@ -144,7 +144,7 @@ services:
container_name: datacite-mock.yoda
platform: linux/amd64
hostname: datacite-mock.yoda
image: ghcr.io/utrechtuniversity/yoda-web-mock:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-web-mock:development
environment:
- MOCKNAME=datacite
- MOCKFQDN=datacite-mock.yoda
Expand Down
14 changes: 7 additions & 7 deletions docker/compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
container_name: provider.yoda
platform: linux/amd64
hostname: provider.yoda
image: ghcr.io/utrechtuniversity/yoda-provider:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-provider:development
ports:
- "8247:1247"
- "20000-20199:20000-20199"
Expand Down Expand Up @@ -56,7 +56,7 @@ services:
container_name: portal.yoda
platform: linux/amd64
hostname: portal.yoda
image: ghcr.io/utrechtuniversity/yoda-portal:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-portal:development
depends_on:
- provider
- eus
Expand All @@ -70,7 +70,7 @@ services:
container_name: eus.yoda
platform: linux/amd64
hostname: eus.yoda
image: ghcr.io/utrechtuniversity/yoda-eus:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-eus:development
depends_on:
- extuserdb
- mailpit
Expand All @@ -84,7 +84,7 @@ services:
container_name: public.yoda
platform: linux/amd64
hostname: public.yoda
image: ghcr.io/utrechtuniversity/yoda-public:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-public:development
ports:
- "8446:443"
build:
Expand All @@ -98,7 +98,7 @@ services:
container_name: data.yoda
platform: linux/amd64
hostname: data.yoda
image: ghcr.io/utrechtuniversity/davrods:dev-1.9
image: ghcr.io/utrechtuniversity/davrods:development
depends_on:
- provider
ports:
Expand All @@ -111,7 +111,7 @@ services:
container_name: mailpit.yoda
platform: linux/amd64
hostname: mailpit.yoda
image: ghcr.io/utrechtuniversity/yoda-mailpit:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-mailpit:development
environment:
- TZ=Europe/Amsterdam
build:
Expand All @@ -124,7 +124,7 @@ services:
container_name: datacite-mock.yoda
platform: linux/amd64
hostname: datacite-mock.yoda
image: ghcr.io/utrechtuniversity/yoda-web-mock:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-web-mock:development
environment:
- MOCKNAME=datacite
- MOCKFQDN=datacite-mock.yoda
Expand Down
4 changes: 3 additions & 1 deletion docker/images/davrods/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ EXPOSE 80
EXPOSE 443

# Application settings
ARG TAG=development
ENV IRODS_VERSION="4.2.11"
ENV YUM_REPO_FILE_LOC "https://packages.irods.org/renci-irods.yum.repo"
ENV YUM_IRODS_REPO_SIGNING_KEY_LOC="https://packages.irods.org/irods-signing-key.asc"
Expand Down Expand Up @@ -61,4 +62,5 @@ COPY footer.html /etc/httpd/irods/footer.html
VOLUME [ "/sys/fs/cgroup" ]
COPY davrods_init.sh /var/lib/irods/scripts/davrods_init.sh
RUN chmod 0755 /var/lib/irods/scripts/davrods_init.sh
CMD ["/var/lib/irods/scripts/davrods_init.sh"]
ENV TAG ${TAG}
CMD ["/var/lib/irods/scripts/davrods_init.sh", "${TAG}"]
2 changes: 1 addition & 1 deletion docker/images/davrods/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
export DOCKER_SCAN_SUGGEST=false
docker build . -t ghcr.io/utrechtuniversity/davrods:dev-1.9 "$@"
docker build . -t "ghcr.io/utrechtuniversity/davrods:development" "$@"
7 changes: 6 additions & 1 deletion docker/images/davrods/davrods_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ set -e
set -o pipefail
set -u

DATA_VERSION="dev-1.9"
DATA_VERSION="$1"

if [ -z "$DATA_VERSION" ]
then echo "Error: no data version argument provided."
exit 1
fi

function before_update {
echo -e "[...] ${1}"
Expand Down
9 changes: 8 additions & 1 deletion docker/images/mailpit/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ set -x

export MAILPIT_VERSION=1.14.0
export DOCKER_SCAN_SUGGEST=false
DOCKER_TAG="$1"

if [ -z "$DOCKER_TAG" ]
then echo "Error: no docker tag argument provided."
exit 1
else shift
fi

if [ -d "mailpit" ]
then rm -rf mailpit
Expand All @@ -14,4 +21,4 @@ fi
git clone https://github.com/axllent/mailpit.git
cd mailpit
git checkout "v$MAILPIT_VERSION"
docker build . -t ghcr.io/utrechtuniversity/yoda-mailpit:dev-1.9 --build-arg VERSION="$MAILPIT_VERSION" "$@"
docker build . -t "ghcr.io/utrechtuniversity/yoda-mailpit:$DOCKER_TAG" --build-arg VERSION="$MAILPIT_VERSION" "$@"
Loading

0 comments on commit a0c09d1

Please sign in to comment.