-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
121 lines (97 loc) · 3.01 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Set arch
ARG BUILD_ARCH=amd64
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.11-0.6.2 AS builder
ARG BUILD_ARCH
# Install requirements
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
ca-certificates \
bzip2 \
gcc \
default-libmysqlclient-dev \
libssl-dev \
pkg-config \
libfontconfig \
&& rm -rf /var/lib/apt/lists/*
# Install requirements for PDF generation
ADD phantomjs-2.1.1-${BUILD_ARCH}.tar.gz /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="dbmi-data-portal"
ARG APP_CODENAME="hypatio"
ARG VERSION
ARG COMMIT
ARG DATE
ARG BUILD_ARCH
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="DBMI Data Portal" \
org.label-schema.url="https://github.com/hms-dbmi/hypatio-app" \
org.label-schema.vcs-url="https://github.com/hms-dbmi/hypatio-app" \
org.label-schema.vcf-ref=${COMMIT}
# Copy PhantomJS binary
COPY --from=builder /tmp/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 \
default-libmysqlclient-dev \
libmagic1 \
&& 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
# Setup entry scripts
ADD 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=dbmi.hypatio.${DBMI_ENV}
ENV DBMI_PARAMETER_STORE_PRIORITY=true
ENV DBMI_AWS_REGION=us-east-1
# App config
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=hypatio
ENV DBMI_APP_ROOT=/app
ENV DBMI_APP_DB=true
ENV DBMI_APP_DOMAIN=portal.dbmi.hms.harvard.edu
# Load balancing
ENV DBMI_LB=true
# SSL and load balancing
ENV DBMI_SSL=true
ENV DBMI_CREATE_SSL=true
ENV DBMI_SSL_PATH=/etc/nginx/ssl
# Static files
ENV DBMI_STATIC_FILES=true
ENV DBMI_APP_STATIC_URL_PATH=/static
ENV DBMI_APP_STATIC_ROOT=/app/assets
# Healthchecks
ENV DBMI_HEALTHCHECK=true
ENV DBMI_HEALTHCHECK_PATH=/healthcheck
ENV DBMI_APP_HEALTHCHECK_PATH=/healthcheck
# File proxy
ENV DBMI_FILE_PROXY=true
ENV DBMI_FILE_PROXY_PATH=/proxy