40 lines
1.5 KiB
Groovy
40 lines
1.5 KiB
Groovy
package script
|
|
|
|
import util.Dockerfiles
|
|
import util.DockerBuildCommandFactory
|
|
import util.GlobalProperties
|
|
import util.ScriptLog
|
|
|
|
/**
|
|
* Скрипт для тестового прогона сборки докер. Просто проверить, что собирается.
|
|
*/
|
|
|
|
@GrabResolver(name='gitea', root='https://git.tswf.io/api/packages/public-repos/maven')
|
|
@Grapes([
|
|
@Grab(group='io.tswf.groovy.better-groovy', module='better-groovy-scripting-shell', version='2.0.2-SNAPSHOT', changing = true),
|
|
@Grab(group='io.tswf.groovy.better-groovy', module='better-groovy-scripting-gitea', version='2.0.2-SNAPSHOT', changing = true)
|
|
])
|
|
_
|
|
|
|
println """
|
|
#############################################################################
|
|
Build Docker Image Script
|
|
#############################################################################
|
|
"""
|
|
|
|
GlobalProperties.loadGlobalProperties()
|
|
|
|
// Проверяем, что установлен docker
|
|
if (System.findExecutablesInPath(['docker']).isEmpty())
|
|
throw new FileNotFoundException("Can't find installed docker-compose at that system!")
|
|
|
|
ScriptLog.printf "Building docker image without tags..."
|
|
|
|
for (def dockerfileName : Dockerfiles.getPresetDockerfiles()) {
|
|
def dockerCommand = DockerBuildCommandFactory.getBuildCommand(dockerfileName)
|
|
ScriptLog.printf "Building dockerfile '${dockerfileName}', full command: '$dockerCommand'"
|
|
sh dockerCommand
|
|
}
|
|
|
|
ScriptLog.printf "Docker image successfully built!"
|