-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #3628: try to build devel images for rel-10_1
- Loading branch information
1 parent
dc4f4ce
commit 24385b5
Showing
2 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
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
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
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` |