forked from mosip/print
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (36 loc) · 2.29 KB
/
Dockerfile
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
45
46
47
48
49
50
51
52
53
54
55
FROM openjdk:11
# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG spring_config_label
# can be passed during Docker build as build time environment for spring profiles active
ARG active_profile
# can be passed during Docker build as build time environment for config server URL
ARG spring_config_url
# can be passed during Docker build as build time environment for glowroot
ARG is_glowroot
# can be passed during Docker build as build time environment for artifactory URL
ARG artifactory_url
# environment variable to pass active profile such as DEV, QA etc at docker runtime
ENV active_profile_env=${active_profile}
# environment variable to pass github branch to pickup configuration from, at docker runtime
ENV spring_config_label_env=${spring_config_label}
# environment variable to pass github branch to pickup configuration from, at docker runtime
ENV spring_config_label_env=${spring_config_label}
# environment variable to pass glowroot, at docker runtime
ENV is_glowroot_env=${is_glowroot}
# environment variable to pass artifactory url, at docker runtime
ENV artifactory_url_env=${artifactory_url}
# change volume to whichever storage directory you want to use for this container.
VOLUME /home/logs /home/Glowroot
COPY ./target/print-*.jar print.jar
EXPOSE 8099
CMD if [ "$is_glowroot_env" = "present" ]; then \
wget "${artifactory_url_env}"/artifactory/libs-release-local/io/mosip/testing/glowroot.zip ; \
apt-get update && apt-get install -y unzip ; \
unzip glowroot.zip ; \
rm -rf glowroot.zip ; \
sed -i 's/<service_name>/print/g' glowroot/glowroot.properties ; \
java -jar -javaagent:glowroot/glowroot.jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" print.jar ; \
else \
java -jar -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" print.jar ; \
fi
#CMD ["java","-Dspring.cloud.config.label=${spring_config_label_env}","-Dspring.profiles.active=${active_profile_env}","-Dspring.cloud.config.uri=${spring_config_url_env}","-jar","-javaagent:/home/Glowroot/glowroot.jar","print.jar"]