File size: 4,565 Bytes
9d54b72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
FROM eclipse-temurin:17 as jre-build

# Create a custom Java runtime
RUN $JAVA_HOME/bin/jlink \
         --add-modules ALL-MODULE-PATH \
         --strip-debug \
         --no-man-pages \
         --no-header-files \
         --compress=2 \
         --output /javaruntime

# Define base image and copy in jlink created minimal Java 17 environment
FROM python:3.10.15-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME

# now we have Java 17 and Python 3.9

RUN apt -y update && \
    apt install -y --no-install-recommends curl dnsutils apt-utils libfreetype6 fontconfig fonts-dejavu && \
    mkdir -p /usr/local/app/lib 

RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata
RUN unlink /etc/localtime || true
RUN ln -s /usr/share/zoneinfo/America/New_York /etc/localtime


RUN python3 -m pip install poetry &&  poetry config cache-dir "/poetry/.cache"
ENV PATH="/root/.poetry/bin:/root/.local/bin:$PATH"

WORKDIR /usr/local/app

# Copy JAR files
COPY ./vcell-api/target/vcell-api-0.0.1-SNAPSHOT.jar \
     ./vcell-api/target/maven-jars/*.jar \
     ./lib/

# Copy and install vcell-cli-utils
COPY ./vcell-cli-utils/ /usr/local/app/python/vcell_cli_utils/
RUN cd /usr/local/app/python/vcell_cli_utils/ && \
    poetry config cache-dir "/poetry/.cache" --local && \
    chmod 755 poetry.toml && \
    poetry install

# copy API resources
COPY ./vcell-api/docroot ./docroot
COPY ./vcell-api/webapp ./webapp
COPY ./vcell-api/keystore_macbook.jks .
COPY ./docker/build/vcell-api.log4j.xml .

ENV softwareVersion=SOFTWARE-VERSION-NOT-SET \
	serverid=SITE \
	dburl="db-url-not-set" \
    dbdriver="db-driver-not-set" \
    dbuser="db-user-not-set" \
    jmshost_int_internal=activemqint \
    jmsport_int_internal=61616 \
    jmsuser=clientUser \
    mongodb_host_internal=mongodb \
    mongodb_port_internal=27017 \
    mongodb_database=test \
    jmsblob_minsize=100000 \
    smtp_hostname="smtp-host-not-set" \
	smtp_port="smtp-port-not-set" \
	smtp_emailaddress="smtp-emailaddress-not-set" \
    simdataCacheSize="simdataCacheSize-not-set" \
	ssl_ignoreHostMismatch=true \
	ssl_ignoreCertProblems=false \
	serverPrefixV0="server-path-prefix-v0-not-set" \
	protocol="https" \
	submit_service_host="submit" \
	workingDir="/usr/local/app"

ENV dbpswdfile=/run/secrets/dbpswd \
    jmspswdfile=/run/secrets/jmspswd \
    keystore=/run/secrets/keystorefile \
    keystorepswdfile=/run/secrets/keystorepswd \
    vcellapi_privatekeyfile=/run/secrets/apiprivkey \
    vcellapi_publickeyfile=/run/secrets/apipubkey

EXPOSE 8080
EXPOSE 8000

ENTRYPOINT java \
    -Xdebug -agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n \
    -XX:MaxRAMPercentage=80 \
#    -XX:+PrintFlagsFinal -XshowSettings:vm \
	-Dvcell.softwareVersion="${softwareVersion}" \
	-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager \
	-Dlog4j.configurationFile=/usr/local/app/vcell-api.log4j.xml \
	-Dvcell.server.id="${serverid}" \
	-Dvcell.serverPrefix.v0="${serverPrefixV0}" \
	-Dvcell.installDir=/usr/local/app \
	-Dcli.workingDir="${workingDir}" \
	-Dvcell.server.dbConnectURL="${dburl}" \
	-Dvcell.server.dbDriverName="${dbdriver}" \
	-Dvcell.server.dbUserid="${dbuser}" \
	-Dvcell.db.pswdfile="${dbpswdfile}" \
	-Dvcell.n5DataDir.internal=/n5DataDir \
	-Dvcell.primarySimdatadir.internal=/simdata \
	-Dvcell.secondarySimdatadir.internal=/simdata_secondary \
	-Dvcell.simdataCacheSize="${simdataCacheSize}" \
	-Dvcell.jms.int.host.internal="${jmshost_int_internal}" \
	-Dvcell.jms.int.port.internal="${jmsport_int_internal}" \
	-Dvcell.jms.blobMessageUseMongo=true \
	-Dvcell.jms.blobMessageMinSize="${jmsblob_minsize}" \
	-Dvcell.jms.user="${jmsuser}" \
	-Dvcell.jms.pswdfile="${jmspswdfile}" \
	-Dvcell.mongodb.host.internal=${mongodb_host_internal} \
	-Dvcell.mongodb.port.internal=${mongodb_port_internal} \
	-Dvcell.mongodb.database=${mongodb_database} \
	-Dvcellapi.keystore.file="${keystore}" \
	-Dvcellapi.keystore.pswdfile="${keystorepswdfile}" \
	-Dvcell.smtp.hostName="${smtp_hostname}" \
	-Dvcell.smtp.port="${smtp_port}" \
	-Dvcell.smtp.emailAddress="${smtp_emailaddress}" \
	-Dvcell.ssl.ignoreHostMismatch="${ssl_ignoreHostMismatch}" \
	-Dvcell.ssl.ignoreCertProblems="${ssl_ignoreCertProblems}" \
	-Dvcell.submit.service.host="${submit_service_host}" \
	-Dvcellapi.privateKey.file="${vcellapi_privatekeyfile}" \
	-Dvcellapi.publicKey.file="${vcellapi_publickeyfile}" \
	-cp "./lib/*" org.vcell.rest.VCellApiMain \
	/usr/local/app/docroot 8080 ${protocol}