diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c19bbb8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM eclipse-temurin:17-jdk-focal +WORKDIR /app + +COPY ./build/libs/* ./app.jar + +EXPOSE 8080 +CMD ["java","-jar","app.jar"] diff --git a/README.md b/README.md index 12d76fe..8d20d46 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,26 @@ Available env variables with their default values that you can overwrite: | NEXTCLOUD_DB_PASS | nextcloud | nextcloud database password | +## Running in Docker +You can build your Docker image using the `docker build -t nextcloud-dlna .` command. Next, you need to run the docker +image with the `net=host` option e.g: + +``` +docker run -d \ +--name="nextcloud-dlna" \ +--net=host \ +-v /path/to/nextcloud/app/ending/with/data:/nextcloud \ +-e NEXTCLOUD_DATA_DIR=/nextcloud \ +-e NEXTCLOUD_DB_HOST='' \ +-e NEXTCLOUD_DB_PASS='' \ +nextcloud-dlna +``` + +You can pass to the container other env variables that are listed above. + +Note that it would not work on Mac OS since docker is a Linux container and the `host` networking mode doesn't actually +share the host's network interfaces. + ### Code used Some java code was taken from https://github.com/haku/dlnatoad diff --git a/a.sh b/a.sh new file mode 100755 index 0000000..4101ed3 --- /dev/null +++ b/a.sh @@ -0,0 +1,4 @@ +while :; do + echo "hello" + sleep 1 +done diff --git a/build.gradle b/build.gradle index a303f9a..19d2834 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,10 @@ java { sourceCompatibility = '17' } +jar { + enabled = false +} + repositories { mavenCentral() } diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..bc3e6e6 --- /dev/null +++ b/run.sh @@ -0,0 +1,9 @@ +docker run -d \ + --name="nextcloud-dlna" \ + --net=host \ + -e NEXTCLOUD_DLNA_INTERFACE=en0 \ + -e NEXTCLOUD_DB_HOST='192.168.0.88' \ + -e NEXTCLOUD_DB_PASS='p4szt3t!' \ + -v '/Users/xis/projects/playground/docker/nextcloud/app/data:/nextcloud' \ + -e NEXTCLOUD_DATA_DIR=/nextcloud \ + nextcloud-dlna diff --git a/src/main/kotlin/net/schowek/nextclouddlna/nextcloud/db/AppConfigRepository.kt b/src/main/kotlin/net/schowek/nextclouddlna/nextcloud/db/AppConfigRepository.kt index 79c80af..6acd1d3 100644 --- a/src/main/kotlin/net/schowek/nextclouddlna/nextcloud/db/AppConfigRepository.kt +++ b/src/main/kotlin/net/schowek/nextclouddlna/nextcloud/db/AppConfigRepository.kt @@ -33,5 +33,22 @@ data class AppConfigId( val appId: String, @Column(name = "configkey") val configKey: String -) + +) { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as AppConfigId + + if (appId != other.appId) return false + return configKey == other.configKey + } + + override fun hashCode(): Int { + var result = appId.hashCode() + result = 31 * result + configKey.hashCode() + return result + } +}