CatgirlIntelligenceAgency/docker-service.gradle
Viktor Lofgren 734996002c (*) install script for deploying Marginalia outside the codebase
The changeset also makes the control service responsible for flyway migrations.  This helps reduce the number of places the database configuration needs to be spread out.  These automatic migrations can be disabled with -DdisableFlyway=true.

The commit also adds curl to the docker container, to enable docker health checks and interdependencies.
2024-01-11 12:40:03 +01:00

48 lines
1.1 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
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
}