NoIssue: Fix for build, run and publish

This commit is contained in:
2026-02-01 19:17:45 +01:00
parent ff92f6c868
commit 5d179979f3
7 changed files with 16 additions and 25 deletions

View File

@@ -46,7 +46,7 @@ java {
toolchain { languageVersion.set(JavaLanguageVersion.of(25)) } toolchain { languageVersion.set(JavaLanguageVersion.of(25)) }
} }
tasks.withType<JavaCompile> { tasks.withType<JavaCompile>().configureEach {
options.release.set(25) options.release.set(25)
options.compilerArgs.add("--enable-preview") options.compilerArgs.add("--enable-preview")
} }

View File

@@ -13,13 +13,14 @@ export VERSION_LONG=${VERSION}_${GITHASH}
# Build this artifact # Build this artifact
echo "Building 'NenjimKicker v${VERSION_LONG}'..." echo "Building 'NenjimKicker v${VERSION_LONG}'..."
./gradlew -Pversion=$VERSION jar prepareDockerLibs ./gradlew -Pversion=$VERSION jar prepareLibs
# Prepare container dependencies # Prepare container dependencies
mkdir -p build/docker/conf mkdir -p build/docker/{conf,libs}
cd build/docker cd build/docker
cp ../../src/main/docker/start.sh start.sh cp ../../src/main/docker/run.sh run.sh
cp ../libs/kicker-impl-ref-*.jar libs cp ../libs/*.jar libs/
cp ../../conf/* conf cp ../../conf/* conf/
sed -e "s|_VERSION_|${VERSION}|g" \ sed -e "s|_VERSION_|${VERSION}|g" \
-e "s|_JREVERSION_|${JREVERSION}|g" \ -e "s|_JREVERSION_|${JREVERSION}|g" \
../../src/main/docker/Dockerfile_template > Dockerfile ../../src/main/docker/Dockerfile_template > Dockerfile
@@ -32,7 +33,6 @@ HASHTAG=${BASETAG}:${GITHASH}_amd64
VERSIONTAG=${BASETAG}:${VERSION}_amd64 VERSIONTAG=${BASETAG}:${VERSION}_amd64
LATESTTAG=${BASETAG}:latest_amd64 LATESTTAG=${BASETAG}:latest_amd64
CANONICALNAME=${HASHTAG} CANONICALNAME=${HASHTAG}
docker build -t ${CANONICALNAME} . docker build -t ${CANONICALNAME} .
docker tag ${CANONICALNAME} ${VERSIONTAG} docker tag ${CANONICALNAME} ${VERSIONTAG}
docker tag ${CANONICALNAME} ${LATESTTAG} docker tag ${CANONICALNAME} ${LATESTTAG}

1
libs Symbolic link
View File

@@ -0,0 +1 @@
build/libs

View File

@@ -1,6 +0,0 @@
export VERSION=$(git describe --tags --exact-match 2>/dev/null \
|| git symbolic-ref --short -q HEAD \
|| git rev-parse --short HEAD)
echo "Building and publishing (CI/CD) $VERSION..."
./gradlew -Pversion=$VERSION publish

1
publishCICD.sh Symbolic link
View File

@@ -0,0 +1 @@
publish.sh

6
run.sh
View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
./gradlew run \
-Dlog4j.configurationFile="$PWD/config/log4j2.xml" \
--args="foo bar baz"

1
run.sh Symbolic link
View File

@@ -0,0 +1 @@
src/main/docker/run.sh

View File

@@ -13,7 +13,7 @@ WORKDIR nenjimkicker
RUN mkdir libs RUN mkdir libs
# These dirs are expected to be overshadowed by host mounts # These dirs are expected to be overshadowed by host mounts
RUN mkdir conf logs RUN mkdir conf logs && chown user:user logs
# Set timezone # Set timezone
ENV TZ=Europe/Copenhagen ENV TZ=Europe/Copenhagen
@@ -29,14 +29,14 @@ RUN apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install application and configuration (Do this as late as possible to be able to reuse layers between builds) # Install application and configuration (Do this as late as possible to be able to reuse layers between builds)
COPY start.sh . COPY run.sh .
COPY conf/* conf/ COPY conf/* conf/
COPY libs/*.jar libs/ COPY libs/*.jar libs/
RUN chmod 755 ./start.sh \ RUN chmod 755 ./run.sh \
&& chmod -R a+rX /usr/local/software/nenjimkicker-_VERSION_ && chmod -R a+rX /usr/local/software/nenjimkicker-_VERSION_
USER user:user USER user:user
CMD ["./start.sh"] CMD ["./run.sh"]

View File

@@ -12,6 +12,6 @@ fi
CLASSPATH=$(IFS=:; echo "${jars[*]}") CLASSPATH=$(IFS=:; echo "${jars[*]}")
exec java \ exec java \
-Dlog4j.configurationFile=/usr/local/software/nenjimkicker/conf/log4j2.xml \ -Dlog4j.configurationFile=conf/log4j2.xml \
-cp "$CLASSPATH" \ -cp "$CLASSPATH" \
com.r35157.nenjim.kicker.impl.ref.Main com.r35157.nenjim.kicker.impl.ref.Main