-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
44 lines (36 loc) · 1.21 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
plugins {
id "com.github.node-gradle.node" version "3.0.1"
}
apply from: "$rootProject.projectDir/shared.gradle"
apply plugin: 'com.bmuschko.docker-remote-api'
node {
download = true
version = '14.16.0'
}
task syncNpm(type: Copy) {
dependsOn npm_run_build
from "nginx.conf"
into dockerBuildDir
from "dist"
into "$dockerBuildDir/dist"
}
task createDockerfile(type: Dockerfile) {
from 'nginx:1.17.7-alpine'
label(['maintainer': 'Valentyn Berezin [email protected]"'])
workingDir("/app")
copyFile("dist/nginx.conf", "/etc/nginx/nginx.conf.template")
copyFile("dist/time-tracker-ui", "/app/dist")
runCommand("echo 'export DOLLAR=\'\$\''; > run.sh")
runCommand("echo 'envsubst < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf' >> run.sh")
runCommand("echo 'nginx -g \"daemon off;\"' >> run.sh && chmod +x run.sh")
entryPoint('sh')
defaultCommand('./run.sh')
exposePort(80)
}
task buildImage(type: DockerBuildImage) {
dependsOn createDockerfile, syncNpm
inputDir.set(project.file(dockerBuildDir))
images.add("ua-timetracker/time-tracker-ui:${commitSha()}")
}