-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
102 lines (82 loc) · 2.82 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
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
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.2 AS builder
# Install requirements
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
ca-certificates \
bzip2 \
gcc \
libssl-dev \
libfontconfig \
&& rm -rf /var/lib/apt/lists/*
# Install requirements for PDF generation
ADD phantomjs-2.1.1-linux-x86_64.tar.bz2 /tmp/
# Add requirements
ADD requirements.* /
# Build Python wheels with hash checking
RUN pip install -U wheel \
&& pip wheel -r /requirements.txt \
--wheel-dir=/root/wheels
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.2
ARG APP_NAME="ppm-questionnaire"
ARG APP_CODENAME="fhirquestionnaire"
ARG VERSION
ARG COMMIT
ARG DATE
LABEL org.label-schema.schema-version=1.0 \
org.label-schema.vendor="HMS-DBMI" \
org.label-schema.version=${VERSION} \
org.label-schema.name=${APP_NAME} \
org.label-schema.build-date=${DATE} \
org.label-schema.description="PPM questionnaire service" \
org.label-schema.url="https://github.com/hms-dbmi/fhirquestionnaire" \
org.label-schema.vcs-url="https://github.com/hms-dbmi/fhirquestionnaire" \
org.label-schema.vcf-ref=${COMMIT}
# Copy PhantomJS binary
COPY --from=builder /tmp/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
# Copy Python wheels from builder
COPY --from=builder /root/wheels /root/wheels
# Install requirements
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libfontconfig \
&& rm -rf /var/lib/apt/lists/*
# Add requirements files
ADD requirements.* /
# Install Python packages from wheels
RUN pip install --no-index \
--find-links=/root/wheels \
--force-reinstall \
# Use requirements without hashes to allow using wheels.
# For some reason the hashes of the wheels change between stages
# and Pip errors out on the mismatches.
-r /requirements.in
# Add additional init scripts
COPY docker-entrypoint-init.d/* /docker-entrypoint-init.d/
# Copy app source
COPY /app /app
# Set the build env
ENV DBMI_ENV=prod
# Set app parameters
ENV DBMI_PARAMETER_STORE_PREFIX=ppm.questionnaire.${DBMI_ENV}
ENV DBMI_PARAMETER_STORE_PRIORITY=true
ENV DBMI_AWS_REGION=us-east-1
ENV DBMI_APP_NAME=${APP_NAME}
ENV DBMI_APP_CODENAME=${APP_CODENAME}
ENV DBMI_APP_VERSION=${VERSION}
ENV DBMI_APP_COMMIT=${COMMIT}
ENV DBMI_APP_WSGI=fhirquestionnaire
ENV DBMI_APP_ROOT=/app
ENV DBMI_APP_DOMAIN=p2m2.dbmi.hms.harvard.edu
# Static files
ENV DBMI_STATIC_FILES=true
ENV DBMI_APP_STATIC_URL_PATH=/fhirquestionnaire/static
ENV DBMI_APP_STATIC_ROOT=/app/static
# Set nginx and network parameters
ENV DBMI_LB=true
ENV DBMI_SSL=true
ENV DBMI_CREATE_SSL=true
ENV DBMI_SSL_PATH=/etc/nginx/ssl
ENV DBMI_HEALTHCHECK=true
ENV DBMI_HEALTHCHECK_PATH=/healthcheck
ENV DBMI_APP_HEALTHCHECK_PATH=/healthcheck