-
Notifications
You must be signed in to change notification settings - Fork 213
Expand file tree
/
Copy pathDockerfile
More file actions
101 lines (71 loc) · 4.19 KB
/
Copy pathDockerfile
File metadata and controls
101 lines (71 loc) · 4.19 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
FROM eclipse-temurin:21-jre-alpine
ARG SOURCE
ARG COMMIT_HASH
ARG COMMIT_ID
ARG BUILD_TIME
LABEL source=${SOURCE}
LABEL commit_hash=${COMMIT_HASH}
LABEL commit_id=${COMMIT_ID}
LABEL build_time=${BUILD_TIME}
# 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
ARG iam_adapter_url
# can be passed during Docker build as build time environment management rmi server hostname
ARG management_rmi_server_hostname
# can be passed during Docker build as build time environment management rmi server port
ARG management_jmxremote_rmi_port
# 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 spring configuration url, at docker runtime
ENV spring_config_url_env=${spring_config_url}
# 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}
# environment variable to pass iam_adapter url, at docker runtime
ENV iam_adapter_url_env=${iam_adapter_url}
# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user=mosip
# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_group=mosip
# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_uid=1002
# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_gid=1001
# install packages and create user
RUN apk -q update \
&& apk add -q unzip wget \
&& addgroup -g ${container_user_gid} ${container_user_group} \
&& adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user}
# set working directory for the user
WORKDIR /home/${container_user}
ENV work_dir=/home/${container_user}
ARG loader_path=${work_dir}/additional_jars/
RUN mkdir -p ${loader_path}
ENV loader_path_env=${loader_path}
ADD ./target/*.jar /target/
RUN find /target -name '*.jar' -executable -type f "-print0" | xargs "-0" cp -t / \
&& rm -rf /target \
&& mv /*.jar ${work_dir}/kernel-idgenerator-service.jar
# change permissions of file inside working dir
RUN chown -R ${container_user}:${container_user} /home/${container_user}
# select container user for all tasks
USER ${container_user_uid}:${container_user_gid}
EXPOSE 8080
#Below 4 lines is added only as a temporary fix to downloaded the ceylon dependencies for chime scheduler
#later this chime to be replaced with something else
CMD wget "${artifactory_url_env}"/artifactory/libs-release-local/io/mosip/testing/regproc-reprocessor-ceylon-cache-repo.zip ; \
unzip regproc-reprocessor-ceylon-cache-repo.zip ; \
rm -rf regproc-reprocessor-ceylon-cache-repo.zip ; \
wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \
java -XX:-UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:-UseParallelGC -XX:+UseZGC -XX:+ZGenerational -XX:-UseShenandoahGC -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseCompressedOops -jar -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dceylon.cache.repo=./regproc-reprocessor-ceylon-cache-repo kernel-idgenerator-service.jar ; \