Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build & Push to GHCR

on:
workflow_dispatch:
push:
# tags:
# - 'v*'
# - '!v*-alpha*'
Comment on lines +6 to +8
Copy link
Preview

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out tag trigger configuration should either be removed or uncommented with proper documentation explaining when it should be enabled.

Suggested change
# tags:
# - 'v*'
# - '!v*-alpha*'
tags:
- 'v*' # Trigger workflow for version tags (e.g., v1.0.0)
- '!v*-alpha*' # Exclude alpha pre-release tags (e.g., v1.0.0-alpha)

Copilot uses AI. Check for mistakes.


jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version & image name
id: vars
run: |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
raw_tag="${GITHUB_REF#refs/tags/}"
version="${raw_tag#v}"
else
# ----- Branch / PR fallback -----
branch="${GITHUB_REF#refs/heads/}"
# Replace / and uppercase chars with safe lowercase dashes
safe_branch=$(echo "$branch" | tr '[:upper:]/' '[:lower:]-')
sha=${GITHUB_SHA::8}
raw_tag="${safe_branch}-${sha}"
version="$raw_tag"
fi
image_repo="ghcr.io/${GITHUB_REPOSITORY,,}"
echo "raw_tag=$raw_tag" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "image_repo=$image_repo" >> "$GITHUB_OUTPUT"

- name: Build & push image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.vars.outputs.image_repo }}:${{ steps.vars.outputs.version }}
${{ steps.vars.outputs.image_repo }}:${{ steps.vars.outputs.raw_tag }}
${{ steps.vars.outputs.image_repo }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# syntax=docker/dockerfile:1
FROM solr:8.11.2

USER root
ENV IBEXA_TEMPLATE_DIR=/opt/solr/server/ibexa/template

RUN mkdir -p ${IBEXA_TEMPLATE_DIR}
COPY src/lib/Resources/config/solr/ ${IBEXA_TEMPLATE_DIR}/

RUN set -eux; \
mkdir -p /opt/solr/server/ibexa; \
for f in solrconfig.xml stopwords.txt synonyms.txt; do \
cp /opt/solr/server/solr/configsets/_default/conf/$f ${IBEXA_TEMPLATE_DIR}/; \
done; \
cp /opt/solr/server/solr/solr.xml /opt/solr/server/ibexa/

RUN sed -i.bak '/<updateRequestProcessorChain name="add-unknown-fields-to-the-schema"/,/<\/updateRequestProcessorChain>/d' \
${IBEXA_TEMPLATE_DIR}/solrconfig.xml \
&& sed -i '/<autoSoftCommit>/,/<\/autoSoftCommit>/c\<autoSoftCommit>\n <maxTime>${solr.autoSoftCommit.maxTime:20}</maxTime>\n</autoSoftCommit>' \
${IBEXA_TEMPLATE_DIR}/solrconfig.xml


USER solr
ENV SOLR_CORE=collection1
CMD ["bash", "-c", "solr-precreate \"$SOLR_CORE\" \"$IBEXA_TEMPLATE_DIR\""]
Loading