Skip to content

Commit

Permalink
Issue #3628: try to build devel images for rel-10_1
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Jul 23, 2024
1 parent dc4f4ce commit 24385b5
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/cache_local_lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
path: local
key: ${{ runner.os }}-${{steps.get-sha.outputs.result}}-local_lib-20240320a

- name: 'check out OTOBO'
- name: 'check out the relevant OTOBO branch'
if: steps.cache_local_lib.outputs.cache-hit != 'true'
uses: actions/checkout@v4

Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/docker_image_builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
%YAML 1.1
---
name: 'DockerImageBuilder'

on:

# build a devel Docker image whenever there is a push into the listed branches
push:
branches:
- rel-10_0

jobs:
BuildDockerImage:

runs-on: 'ubuntu-latest'

steps:

- name: Setup
run: |
# e.g rel-10_0
branch="${{ github.ref_name }}"
# e.g. 10_0
branch_without_rel="${docker_branch:4}"
build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
(
echo "otobo_branch=$branch_without_rel"
echo "otobo_build_date=$build_date"
echo "otobo_docker_tag=devel-$branch_without_rel"
echo "otobo_commit=${{ github.sha }}"
) >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: 'check out the relevant OTOBO branch'
uses: actions/checkout@v4

-
# build the image, not pushing yet, no pushing as DockerHub access is not set up yet
# Caching with Github Actions Cache, limited to 10 GB
# context: . indicates that the current checkout is used
name: Build
uses: docker/build-push-action@v6
with:
load: true
context: .
file: otobo.web.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 }}
target: otobo-web
tags: ${{ env.otobo_ref }}
cache-from: type=gha
cache-to: type=gha,mode=max`

-
# otobo_first_time hasn't run yet, so /opt/otobo is still empty
name: Info
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 only after the build
name: Login to Docker Hub
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
uses: docker/build-push-action@v6
with:
push: true
context: .
file: otobo.web.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 }}
target: otobo-web
tags: ${{ env.otobo_ref }}
cache-from: type=gha
cache-to: type=gha,mode=max`

0 comments on commit 24385b5

Please sign in to comment.