Files
Remsly/.space.kts
T
2024-12-24 17:13:02 +01:00

137 lines
5.0 KiB
Kotlin

job("Build") {
parallel {
container(displayName = "BE Build", image = "openjdk:17") {
env["EL_HOST"] = "elasticsearch"
env["DB_HOST_PORT"] = "postgres:5432"
env["DB_USER"] = "develop"
env["DB_PASSWD"] = "develop"
env["DB_NAME"] = "develop"
service("postgres:14-alpine") {
alias("postgres")
env["POSTGRES_USER"] = "develop"
env["POSTGRES_PASSWORD"] = "develop"
env["POSTGRES_DB"] = "develop"
resources {
cpu = 1.cpu
memory = 2000.mb
}
}
// service("elasticsearch:8.5.3") {
// alias("elasticsearch")
// env["ELASTIC_PASSWORD"] = "elasticPassword"
// env["discovery.type"] = "single-node"
// resources {
// cpu = 1.cpu
// memory = 2000.mb
// }
// }
shellScript {
content = """
./gradlew build -PDB_HOST_PORT=postgres:5432 -PDB_USER=develop -PDB_PASSWD=develop -PDB_NAME=develop;
cp backend/build/libs/backend-version.jar /mnt/space/share/backend-version.jar;
""".trimMargin()
}
}
container(displayName = "FE Build", image = "node:16.15.1") {
shellScript {
content = """
(cd frontend; npm ci; npm install -g @angular/cli; npm run buildProd)
cp -R frontend/dist/frontend /mnt/space/share/frontend;
""".trimMargin()
}
}
}
parallel {
host("BE Docker") {
shellScript {
content = """
mkdir -p backend/build/libs;
cp ../../share/backend-version.jar backend/build/libs/backend-version.jar;
""".trimIndent()
}
dockerBuildPush {
// by default, the step runs not only 'docker build' but also 'docker push'
// to disable pushing, add the following line:
// push = false
// path to Docker context (by default, context is working dir)
context = "backend"
// path to Dockerfile relative to the project root
// if 'file' is not specified, Docker will look for it in 'context'/Dockerfile
//file = "docker/config/Dockerfile"
// build-time variables
//args["HTTP_PROXY"] = "http://10.20.30.2:1234"
// image labels
//labels["vendor"] = "mycompany"
// to add a raw list of additional build arguments, use
// extraArgsForBuildCommand = listOf("...")
// to add a raw list of additional push arguments, use
// extraArgsForPushCommand = listOf("...")
// image tags
tags {
// use current job run number as a tag - '0.0.run_number'
+"boxi.registry.jetbrains.space/p/boxit/containers/boxit-backend:2024.12.${"$"}JB_SPACE_EXECUTION_NUMBER"
}
}
shellScript {
content = """
rm ../../share/backend-version.jar;
""".trimIndent()
}
}
host("FE Docker") {
shellScript {
content = """
mkdir -p frontend/dist/frontend;
cp -R ../../share/frontend frontend/dist/frontend;
""".trimIndent()
}
dockerBuildPush {
// by default, the step runs not only 'docker build' but also 'docker push'
// to disable pushing, add the following line:
// push = false
// path to Docker context (by default, context is working dir)
context = "frontend"
// path to Dockerfile relative to the project root
// if 'file' is not specified, Docker will look for it in 'context'/Dockerfile
//file = "docker/config/Dockerfile"
// build-time variables
//args["HTTP_PROXY"] = "http://10.20.30.2:1234"
// image labels
//labels["vendor"] = "mycompany"
// to add a raw list of additional build arguments, use
// extraArgsForBuildCommand = listOf("...")
// to add a raw list of additional push arguments, use
// extraArgsForPushCommand = listOf("...")
// image tags
tags {
// use current job run number as a tag - '0.0.run_number'
+"boxi.registry.jetbrains.space/p/boxit/containers/boxit-frontend:2024.12.${"$"}JB_SPACE_EXECUTION_NUMBER"
}
}
shellScript {
content = """
rm -rf ../../share/frontend;
""".trimIndent()
}
}
}
}