add Docker support

add hashCode && equals
This commit is contained in:
xis 2023-10-13 20:32:15 +02:00
parent eef25cd418
commit 9be7c7e5d9
6 changed files with 62 additions and 1 deletions

7
Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM eclipse-temurin:17-jdk-focal
WORKDIR /app
COPY ./build/libs/* ./app.jar
EXPOSE 8080
CMD ["java","-jar","app.jar"]

View file

@ -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='<your_host_ip_here>' \
-e NEXTCLOUD_DB_PASS='<your_nextcloud_db_pass_here>' \
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

4
a.sh Executable file
View file

@ -0,0 +1,4 @@
while :; do
echo "hello"
sleep 1
done

View file

@ -15,6 +15,10 @@ java {
sourceCompatibility = '17'
}
jar {
enabled = false
}
repositories {
mavenCentral()
}

9
run.sh Executable file
View file

@ -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

View file

@ -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
}
}