Compare commits
5 Commits
b85cf0a3de
...
0.1-dev
| Author | SHA256 | Date | |
|---|---|---|---|
| 24c06ad973 | |||
| 6964530e0a | |||
| 5d179979f3 | |||
| ff92f6c868 | |||
| d67703c8ef |
@@ -11,7 +11,7 @@ if (version == "UNSET" && gradle.startParameter.taskNames.any { it.startsWith("p
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("com.r35157.nenjim.kicker.impl.ref.KickerImpl")
|
||||
mainClass.set("com.r35157.nenjim.kicker.impl.ref.Main")
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -46,25 +46,30 @@ java {
|
||||
toolchain { languageVersion.set(JavaLanguageVersion.of(25)) }
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.release.set(25)
|
||||
options.compilerArgs.add("--enable-preview")
|
||||
}
|
||||
|
||||
val dockerLibsDir = layout.buildDirectory.dir("docker/libs")
|
||||
val libsDir = layout.buildDirectory.dir("libs")
|
||||
|
||||
tasks.register<Sync>("prepareDockerLibs") {
|
||||
tasks.register<Sync>("prepareLibs") {
|
||||
group = "distribution"
|
||||
description = "Copies all runtime dependencies (transitive) to build/docker/libs"
|
||||
description = "Copies runtime deps to build/libs without deleting the app jar"
|
||||
|
||||
// Hvis du også vil bygge dit eget jar samtidig, så lad den stå – ellers kan du fjerne den.
|
||||
dependsOn(tasks.named("jar"))
|
||||
val jarTask = tasks.named<Jar>("jar")
|
||||
dependsOn(jarTask)
|
||||
|
||||
into(dockerLibsDir)
|
||||
into(libsDir)
|
||||
|
||||
// Kun deps (transitivt)
|
||||
from(configurations.runtimeClasspath)
|
||||
|
||||
// Bevar jar-filen som jar-tasken allerede har lagt i build/libs
|
||||
preserve {
|
||||
include(jarTask.get().archiveFileName.get())
|
||||
}
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
|
||||
12
build.sh
12
build.sh
@@ -13,13 +13,14 @@ export VERSION_LONG=${VERSION}_${GITHASH}
|
||||
|
||||
# Build this artifact
|
||||
echo "Building 'NenjimKicker v${VERSION_LONG}'..."
|
||||
./gradlew -Pversion=$VERSION jar prepareDockerLibs
|
||||
./gradlew -Pversion=$VERSION jar prepareLibs
|
||||
|
||||
# Prepare container dependencies
|
||||
mkdir -p build/docker/conf
|
||||
mkdir -p build/docker/{conf,libs}
|
||||
cd build/docker
|
||||
cp ../../src/main/docker/start.sh start.sh
|
||||
cp ../libs/kicker-impl-ref-*.jar libs
|
||||
cp ../../conf/* conf
|
||||
cp ../../src/main/docker/run.sh run.sh
|
||||
cp ../libs/*.jar libs/
|
||||
cp ../../conf/* conf/
|
||||
sed -e "s|_VERSION_|${VERSION}|g" \
|
||||
-e "s|_JREVERSION_|${JREVERSION}|g" \
|
||||
../../src/main/docker/Dockerfile_template > Dockerfile
|
||||
@@ -32,7 +33,6 @@ HASHTAG=${BASETAG}:${GITHASH}_amd64
|
||||
VERSIONTAG=${BASETAG}:${VERSION}_amd64
|
||||
LATESTTAG=${BASETAG}:latest_amd64
|
||||
CANONICALNAME=${HASHTAG}
|
||||
|
||||
docker build -t ${CANONICALNAME} .
|
||||
docker tag ${CANONICALNAME} ${VERSIONTAG}
|
||||
docker tag ${CANONICALNAME} ${LATESTTAG}
|
||||
|
||||
@@ -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
1
publishCICD.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
publish.sh
|
||||
6
run.sh
6
run.sh
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
./gradlew run \
|
||||
-Dlog4j.configurationFile="$PWD/config/log4j2.xml" \
|
||||
--args="foo bar baz"
|
||||
@@ -1 +1 @@
|
||||
rootProject.name = "kicker-impl-ref"
|
||||
rootProject.name = "kicker-impl_ref"
|
||||
|
||||
@@ -13,7 +13,7 @@ WORKDIR nenjimkicker
|
||||
RUN mkdir libs
|
||||
|
||||
# These dirs are expected to be overshadowed by host mounts
|
||||
RUN mkdir conf logs
|
||||
RUN mkdir conf logs && chown user:user logs
|
||||
|
||||
# Set timezone
|
||||
ENV TZ=Europe/Copenhagen
|
||||
@@ -29,14 +29,15 @@ RUN apt-get autoremove -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 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 libs/*.jar libs/
|
||||
|
||||
RUN chmod 755 ./start.sh \
|
||||
RUN chown root:root -R conf
|
||||
RUN chmod 755 ./run.sh \
|
||||
&& chmod -R a+rX /usr/local/software/nenjimkicker-_VERSION_
|
||||
|
||||
USER user:user
|
||||
|
||||
CMD ["./start.sh"]
|
||||
CMD ["./run.sh"]
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ fi
|
||||
CLASSPATH=$(IFS=:; echo "${jars[*]}")
|
||||
|
||||
exec java \
|
||||
-Dlog4j.configurationFile=/usr/local/software/nenjimkicker/conf/log4j2.xml \
|
||||
-Dlog4j.configurationFile=conf/log4j2.xml \
|
||||
-cp "$CLASSPATH" \
|
||||
com.r35157.nenjim.kicker.impl.ref.Main
|
||||
@@ -1,16 +1,20 @@
|
||||
package com.r35157.nenjim.kicker.impl.ref;
|
||||
|
||||
import com.r35157.nenjim.kicker.NenjimProcess;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Dummy implements NenjimProcess {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("Hello! This is '" + getName() + "'");
|
||||
log.error("Process '" + getName() + "' started.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getName() {
|
||||
return "Just A Dummy";
|
||||
}
|
||||
|
||||
private static final Logger log = LogManager.getLogger(Dummy.class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user