mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00

Adds new ways to configure the bind and external IP addresses for a service. Notably, if the environment variable WMSA_IN_DOCKER is present, the system will grab the HOSTNAME variable and announce that as the external address in the service registry. The default bind address is also changed to be 0.0.0.0 only if WMSA_IN_DOCKER is present, otherwise 127.0.0.1; as this is a more secure default.
51 lines
1.2 KiB
Groovy
51 lines
1.2 KiB
Groovy
ext {
|
|
dockerImage='openjdk:21-slim'
|
|
}
|
|
|
|
tasks.register('dockerFile') {
|
|
buildDir.mkdir()
|
|
|
|
var df = new File(buildDir, "Dockerfile")
|
|
doLast {
|
|
df.text = """#
|
|
# I'm auto-generated, please don't make changes to me or commit me to git
|
|
#
|
|
# The template exists in docker-service.gradle
|
|
#
|
|
FROM ${dockerImage}
|
|
|
|
RUN apt-get update && apt-get install -y curl
|
|
ADD ${application.applicationName}.tar /
|
|
RUN mkdir /wmsa
|
|
|
|
# This will make the service grab the hostname from the HOSTNAME variable
|
|
ENV WMSA_IN_DOCKER true
|
|
|
|
ENTRYPOINT WMSA_HOME=/wmsa /${application.applicationName}/bin/${application.applicationName} \${arg0} \${arg1}
|
|
"""
|
|
}
|
|
it.outputs.file(df)
|
|
}
|
|
|
|
dockerPrepare {
|
|
dependsOn tasks.dockerFile
|
|
}
|
|
|
|
dockerfileZip {
|
|
dependsOn tasks.dockerFile
|
|
}
|
|
|
|
|
|
docker {
|
|
dockerfile = tasks.dockerFile.outputs.files.singleFile
|
|
|
|
var registry = project.hasProperty('docker-registry') ? project.property('docker-registry') : 'marginalia'
|
|
var tagName = project.hasProperty('docker-tag') ? project.property('docker-tag') : 'latest'
|
|
|
|
name = registry+'/'+application.applicationName+':'+tagName
|
|
tag 'test', (registry+'/'+application.applicationName+':'+tagName)
|
|
|
|
files tasks.distTar.outputs
|
|
dependsOn tasks.distTar
|
|
}
|