-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
97 lines (79 loc) · 2.55 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
FROM hmsdbmitc/dbmisvc:debian12-slim-python3.12-0.7.0 AS builder
# 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 \
&& rm -rf /var/lib/apt/lists/*
# 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.12-0.7.0
ARG APP_NAME="dbmisvc-starter"
ARG APP_CODENAME="dbmisvc-starter"
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="DBMISVC Starter" \
org.label-schema.url="https://github.com/hms-dbmi/dbmisvc-starter" \
org.label-schema.vcs-url="https://github.com/hms-dbmi/dbmisvc-starter" \
org.label-schema.vcf-ref=${COMMIT}
# 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 \
default-libmysqlclient-dev \
pkg-config \
&& 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 /starter /app
# Set the build env
ENV DBMI_ENV=prod
# Set app parameters
ENV DBMI_PARAMETER_STORE_PREFIX=
ENV DBMI_PARAMETER_STORE_PRIORITY=true
ENV DBMI_SECRETS_MANAGER_PRIORITY=true
ENV DBMI_AWS_REGION=us-east-1
ENV DBMI_APP_WSGI=starter
ENV DBMI_APP_ROOT=/app
ENV DBMI_APP_DB=true
ENV DBMI_APP_DOMAIN=starter.dbmi.hms.harvard.edu
# Static files
ENV DBMI_STATIC_FILES=true
ENV DBMI_APP_STATIC_URL_PATH=/static
ENV DBMI_APP_STATIC_ROOT=/var/www/static
# Set nginx and network parameters
ENV DBMI_PORT=443
ENV DBMI_LB=true
ENV DBMI_SSL=true
ENV DBMI_CREATE_SSL=true
ENV DBMI_HEALTHCHECK=true
# Django configurations
ENV DJANGO_CONFIGURATION=Production
ENV DJANGO_SETTINGS_MODULE=starter.settings