Skip to content

Commit

Permalink
Issue #3628: build the Elasticsearch image on Github
Browse files Browse the repository at this point in the history
The repository on Docker Hub is now also hard coded.
  • Loading branch information
bschmalhofer committed Jul 30, 2024
1 parent 6a80a2d commit f4fd66d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
35 changes: 25 additions & 10 deletions .github/workflows/docker_image_builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ jobs:

runs-on: 'ubuntu-latest'

strategy:

# create different images
matrix:
target: [ 'otobo-web', 'otobo-elasticsearch', ]
include:
- target: 'otobo-web'
dockerfile: 'otobo.web.dockerfile'
context: '.'
tag_prefix: 'devel'
repository: 'rotheross/otobo'
- target: 'otobo-elasticsearch'
dockerfile: 'otobo.elasticsearch.dockerfile'
context: 'scripts/elasticsearch'
tag_prefix: 'devel'
repository: 'rotheross/otobo-elasticsearch'

steps:

-
Expand All @@ -28,14 +45,12 @@ jobs:
name: Setup
run: |
branch="${{ github.ref_name }}" # e.g rel-10_0
docker_tag="devel-$branch"
mixed_case_repository="${{ github.repository }}" # e.g. RotherOSS/otobo
lowercased_repository="${mixed_case_repository,,}" # e.g. rotheross/otobo
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=$lowercased_repository:$docker_tag"
echo "otobo_ref=${{ matrix.repository }}:$docker_tag"
echo "otobo_build_date=$build_date"
echo "otobo_commit=${{ github.sha }}"
) >> $GITHUB_ENV
Expand All @@ -54,8 +69,8 @@ jobs:
uses: docker/build-push-action@v6
with:
load: true
context: .
file: otobo.web.dockerfile
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
pull: true
build-args: |
BUILD_DATE=${{ env.otobo_build_date }}
Expand All @@ -64,7 +79,7 @@ jobs:
GIT_BRANCH=${{ env.otobo_branch }}
GIT_COMMIT=${{ env.otobo_commit }}
tags: ${{ env.otobo_ref }}
target: otobo-web
target: ${{ matrix.target }}
cache-from: type=gha
cache-to: type=gha,mode=max`

Expand All @@ -90,8 +105,8 @@ jobs:
uses: docker/build-push-action@v6
with:
push: true
context: .
file: otobo.web.dockerfile
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
pull: true
build-args: |
BUILD_DATE=${{ env.otobo_build_date }}
Expand All @@ -100,6 +115,6 @@ jobs:
GIT_BRANCH=${{ env.otobo_branch }}
GIT_COMMIT=${{ env.otobo_commit }}
tags: ${{ env.otobo_ref }}
target: otobo-web
target: ${{ matrix.target }}
cache-from: type=gha
cache-to: type=gha,mode=max`
1 change: 1 addition & 0 deletions hooks/build
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# In newer version different image are built with the same Dockerfile.
TARGET_OPTION=$(case $DOCKERFILE_PATH in
"otobo.web.dockerfile") echo "--target=otobo-web" ;;
"otobo.elasticsearch.dockerfile") echo "--target=otobo-elasticsearch" ;;
*) echo "" ;;
esac)

Expand Down
2 changes: 1 addition & 1 deletion otobo.elasticsearch.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Use 7.17.3, because latest flag is not available
# This image is based on Ubuntu 20.04. The User is root.
FROM docker.elastic.co/elasticsearch/elasticsearch:7.17.3
FROM docker.elastic.co/elasticsearch/elasticsearch:7.17.3 AS otobo-elasticsearch

# Install system tools
# Hadolint ignore=DL3008
Expand Down

0 comments on commit f4fd66d

Please sign in to comment.