Added Dockerfile

Added docker-compose.example.yml
Implemented JAR signing with Gradle
This commit is contained in:
grimsi
2025-06-16 19:12:33 +02:00
parent b2cb8ca33e
commit 99893ac0c3
7 changed files with 63 additions and 16 deletions
+3 -3
View File
@@ -2,7 +2,7 @@
<configuration default="false" name="Production build" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalProjectPath" value="$PROJECT_DIR$/app" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-Pvaadin.productionMode=true" />
<option name="taskDescriptions">
@@ -10,8 +10,8 @@
</option>
<option name="taskNames">
<list>
<option value=":gameyfin:clean" />
<option value=":gameyfin:build" />
<option value="clean" />
<option value="build" />
</list>
</option>
<option name="vmOptions" />
+1 -1
View File
@@ -1,5 +1,5 @@
group = "de.grimsi"
val appMainClass = "org.gameyfin.GameyfinApplicationKt"
val appMainClass = "org.gameyfin.app.GameyfinApplicationKt"
plugins {
id("org.springframework.boot")
Binary file not shown.
+14 -9
View File
@@ -1,21 +1,26 @@
# syntax=docker/dockerfile:1.4
FROM eclipse-temurin:21-jre-alpine
ENV GAMEYFIN_SOURCES=/opt/gameyfin-library
ENV USER=gameyfin
RUN addgroup gameyfin && \
adduser --disabled-password --gecos "" --ingroup "$USER" --no-create-home "$USER" && \
mkdir -p /opt/gameyfin ${GAMEYFIN_SOURCES} && \
chown -R gameyfin:gameyfin /opt/gameyfin ${GAMEYFIN_SOURCES}
adduser --disabled-password --gecos "" --ingroup "$USER" --no-create-home "$USER"
USER gameyfin:gameyfin
ARG JAR_FILE=./backend/target/*.jar
COPY ${JAR_FILE} /opt/gameyfin/gameyfin.jar
WORKDIR /opt/gameyfin
# Copy application jar (not ending with -plain.jar)
COPY --chown=gameyfin:gameyfin ./app/build/libs/ /tmp/app-libs/
RUN find /tmp/app-libs -type f -name "*.jar" ! -name "*-plain.jar" -exec cp {} /opt/gameyfin/gameyfin.jar \; && \
rm -rf /tmp/app-libs
# Copy all plugin jars
COPY --chown=gameyfin:gameyfin ./plugins/ /tmp/plugins/
RUN mkdir -p /opt/gameyfin/plugins && \
find /tmp/plugins -type f -path "*/build/libs/*.jar" -exec cp {} /opt/gameyfin/plugins/ \; && \
rm -rf /tmp/plugins
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "gameyfin.jar"]
ENTRYPOINT ["java", "-jar", "gameyfin.jar"]
+10 -3
View File
@@ -1,11 +1,18 @@
version: "3"
services:
gameyfin:
image: grimsi/gameyfin:v2
image: gameyfin/app:2.0.0.beta2
container_name: gameyfin
environment:
PLACEHOLDER: ""
# Generate a new APP_KEY using the command `openssl rand -base64 32` or similar.
APP_KEY: <you app key here>
volumes:
- <path to your game library>:/opt/gameyfin-library
- "./db:/opt/gameyfin/db"
- "./data:/opt/gameyfin/data"
- "./logs:/opt/gameyfin/logs"
- <mount your library folder(s) here>
ports:
- "8080:8080"
# If you plan to use the included torrent plugin, uncomment the following lines:
# - "6969:6969"
# - "6881:6881"
+2
View File
@@ -1,3 +1,5 @@
# Increase Gradle metaspace size
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m
# Plugin versions
kotlinVersion=2.1.21
kspVersion=2.1.21-2.0.1
+33
View File
@@ -4,6 +4,13 @@ plugins {
kotlin("jvm")
}
val keystorePath: String = rootProject.file("certs/gameyfin.jks").absolutePath
val keystoreAlias = "gameyfin-plugins"
val keystorePassword: String = (findProperty("keystorePassword") as String?)
?: System.getenv("GAMEYFIN_KEYSTORE_PASSWORD")
?: ""
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
@@ -56,4 +63,30 @@ subprojects {
tasks.build {
dependsOn("copyDependencyClasses")
}
tasks.register<Exec>("signJar") {
dependsOn(tasks.jar)
val jarFile = tasks.jar.get().archiveFile.get().asFile
// Only enable if password is present
enabled = keystorePassword.isNotEmpty()
commandLine(
"jarsigner",
"-keystore", keystorePath,
"-storepass", keystorePassword,
jarFile.absolutePath,
keystoreAlias
)
doFirst {
if (keystorePassword.isEmpty()) {
logger.lifecycle("Keystore password not provided, skipping JAR signing.")
}
}
}
tasks.build {
dependsOn("signJar")
}
}