Change some otobo.de to otobo.io #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML 1.1 | |
--- | |
# Workflow for building Docker images. For now only devel images are built | |
# and pushed to Docker Hub. | |
name: 'DockerImageBuilder' | |
on: | |
# Build a devel Docker image whenever there is a push into the listed branches. | |
push: | |
branches: | |
- rel-10_0 | |
- rel-10_1 | |
- rel-11_0 | |
- rel-11_1 | |
jobs: | |
BuildDockerImage: | |
runs-on: 'ubuntu-latest' | |
strategy: | |
# create different images | |
matrix: | |
target: [ 'otobo-web', 'otobo-web-kerberos', 'otobo-elasticsearch', 'otobo-nginx-webproxy', 'otobo-nginx-kerberos-webproxy', 'otobo-selenium-chrome' ] | |
include: | |
- | |
target: 'otobo-web' | |
dockerfile: 'otobo.web.dockerfile' | |
context: '.' | |
tag_prefix: 'devel' | |
repository: 'rotheross/otobo' | |
- | |
target: 'otobo-web-kerberos' | |
dockerfile: 'otobo.web.dockerfile' | |
context: '.' | |
tag_prefix: 'devel-kerberos' | |
repository: 'rotheross/otobo' | |
- | |
target: 'otobo-elasticsearch' | |
dockerfile: 'otobo.elasticsearch.dockerfile' | |
context: 'scripts/elasticsearch' | |
tag_prefix: 'devel' | |
repository: 'rotheross/otobo-elasticsearch' | |
- | |
target: 'otobo-nginx-webproxy' | |
dockerfile: 'otobo.nginx.dockerfile' | |
context: 'scripts/nginx' | |
tag_prefix: 'devel' | |
repository: 'rotheross/otobo-nginx-webproxy' | |
- | |
target: 'otobo-nginx-kerberos-webproxy' | |
dockerfile: 'otobo.nginx.dockerfile' | |
context: 'scripts/nginx' | |
tag_prefix: 'devel' | |
repository: 'rotheross/otobo-nginx-kerberos-webproxy' | |
- | |
target: 'otobo-selenium-chrome' | |
dockerfile: 'otobo.selenium-chrome.dockerfile' | |
context: 'scripts/test/sample' | |
tag_prefix: 'devel' | |
repository: 'rotheross/otobo-nginx-kerberos-webproxy' | |
steps: | |
- | |
# Store some variables in an environment file so that | |
# they can be used in the later steps. | |
name: Setup | |
run: | | |
branch="${{ github.ref_name }}" # e.g rel-10_0 | |
docker_tag="${{ matrix.tag_prefix }}-$branch" | |
build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ') | |
( | |
echo "otobo_branch=$branch" | |
echo "otobo_docker_tag=$docker_tag" | |
echo "otobo_ref=${{ matrix.repository }}:$docker_tag" | |
echo "otobo_build_date=$build_date" | |
echo "otobo_commit=${{ github.sha }}" | |
) >> $GITHUB_ENV | |
- name: 'check out the relevant OTOBO branch' | |
uses: actions/checkout@v4 | |
- | |
# check whether an devel image must be built | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
base: "${{ github.ref_name }}" # e.g rel-10_0 | |
filters: | | |
context: | |
- '${{ matrix.context }}/**' | |
- | |
name: Set up Docker Buildx | |
if: steps.changes.outputs.context == 'true' | |
uses: docker/setup-buildx-action@v3 | |
- | |
# Build the image but do not push it to Docker Hub yet. | |
# Enable caching with Github Actions Cache, which is limited to 10 GB. | |
# context: . indicates that the current checkout is used | |
name: Build | |
if: steps.changes.outputs.context == 'true' | |
uses: docker/build-push-action@v6 | |
with: | |
load: true | |
context: ${{ matrix.context }} | |
file: ${{ matrix.dockerfile }} | |
pull: true | |
build-args: | | |
BUILD_DATE=${{ env.otobo_build_date }} | |
DOCKER_TAG=${{ env.otobo_docker_tag }} | |
GIT_REPO=${{ github.repositoryUrl }} | |
GIT_BRANCH=${{ env.otobo_branch }} | |
GIT_COMMIT=${{ env.otobo_commit }} | |
tags: ${{ env.otobo_ref }} | |
target: ${{ matrix.target }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max` | |
- | |
# Show some files in the image just to check sanity. | |
# otobo_first_time hasn't run yet, so /opt/otobo is still empty | |
name: Info | |
if: ${{ steps.changes.outputs.context == 'true' && matrix.dockerfile == 'otobo.web.dockerfile' }} | |
run: | | |
docker run --rm -w /opt/otobo_install/otobo_next --entrypoint /bin/bash $otobo_ref -c "more git-repo.txt git-branch.txt git-commit.txt RELEASE | cat" | |
- | |
# login to Docker Hub before pushing to Docker Hub | |
name: Login to Docker Hub | |
if: steps.changes.outputs.context == 'true' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
# finally upload to DockerHub | |
# the built image is already available in the job | |
name: Push to DockerHub | |
if: steps.changes.outputs.context == 'true' | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: ${{ matrix.context }} | |
file: ${{ matrix.dockerfile }} | |
pull: true | |
build-args: | | |
BUILD_DATE=${{ env.otobo_build_date }} | |
DOCKER_TAG=${{ env.otobo_docker_tag }} | |
GIT_REPO=${{ github.repositoryUrl }} | |
GIT_BRANCH=${{ env.otobo_branch }} | |
GIT_COMMIT=${{ env.otobo_commit }} | |
tags: ${{ env.otobo_ref }} | |
target: ${{ matrix.target }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max` |