-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBackend.Dockerfile
63 lines (45 loc) · 1.9 KB
/
Backend.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
56
57
58
59
60
61
62
63
# Build image
FROM openjdk:11-jre AS builder
# Change to latest release
ARG VERSION=2209
ARG BWHC_BASE_DIR=/bwhc-backend
ENV BWHC_BASE_DIR=$BWHC_BASE_DIR
COPY bwhc-backend_$VERSION.zip /
RUN unzip bwhc-backend_$VERSION.zip && rm bwhc-backend_$VERSION.zip
WORKDIR $BWHC_BASE_DIR
# Prepare config file to use environment variables from docker
RUN sed -i -r "s/APPLICATION_SECRET(.*)/#APPLICATION_SECRET\1/" ./config
RUN sed -i -r "s/ZPM_SITE(.*)/#ZPM_SITE\1/" ./config
# Prepare config file to use fix environment variables for this image
RUN sed -i -r "s~BWHC_DATA_ENTRY_DIR.*~BWHC_DATA_ENTRY_DIR=$BWHC_DATA_ENTRY_DIR~" ./config
RUN sed -i -r "s~BWHC_QUERY_DATA_DIR.*~BWHC_QUERY_DATA_DIR=$BWHC_QUERY_DATA_DIR~" ./config
RUN sed -i -r "s~BWHC_USER_DB_DIR.*~BWHC_USER_DB_DIR=$BWHC_USER_DB_DIR~" ./config
RUN ./install.sh $BWHC_BASE_DIR
# Cleanup
RUN mv bwhc-rest-api-gateway-*/ bwhc-rest-api-gateway/
RUN rm *.zip bwhc-backend-service
# Final image
FROM openjdk:11-jre
ARG BWHC_BASE_DIR=/bwhc-backend
ENV BWHC_BASE_DIR=$BWHC_BASE_DIR
ENV BWHC_USER_DB_DIR=$BWHC_BASE_DIR/data/user-db
ENV BWHC_DATA_ENTRY_DIR=$BWHC_BASE_DIR/data/data-entry
ENV BWHC_QUERY_DATA_DIR=$BWHC_BASE_DIR/data/query-data
ENV BWHC_CONNECTOR_CONFIG=$BWHC_BASE_DIR/bwhcConnectorConfig.xml
USER 999
COPY --from=builder $BWHC_BASE_DIR/ $BWHC_BASE_DIR/
VOLUME $BWHC_BASE_DIR/data
VOLUME $BWHC_BASE_DIR/hgnc_data
EXPOSE 9000
WORKDIR $BWHC_BASE_DIR
CMD $BWHC_BASE_DIR/bwhc-rest-api-gateway/bin/bwhc-rest-api-gateway \
-Dplay.http.secret.key=$APPLICATION_SECRET \
-Dconfig.file=$BWHC_BASE_DIR/production.conf \
-Dlogger.file=$BWHC_BASE_DIR/logback.xml \
-Dpidfile.path=/dev/null \
-Dbwhc.zpm.site=$ZPM_SITE \
-Dbwhc.data.entry.dir=$BWHC_DATA_ENTRY_DIR \
-Dbwhc.query.data.dir=$BWHC_QUERY_DATA_DIR \
-Dbwhc.user.data.dir=$BWHC_USER_DB_DIR \
-Dbwhc.hgnc.dir=$BWHC_HGNC_DIR \
-Dbwhc.connector.configFile=$BWHC_CONNECTOR_CONFIG