-
Notifications
You must be signed in to change notification settings - Fork 63
/
Dockerfile
46 lines (40 loc) · 1.53 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
FROM materialsproject/devops:python-3.913.12 as base
FROM base as builder
RUN apt-get update && apt-get install -y --no-install-recommends gcc git g++ cmake make libsnappy-dev wget && apt-get clean
ENV PATH /root/.local/bin:$PATH
WORKDIR /emmet-api
ENV PIP_FLAGS "--user --no-cache-dir --compile"
COPY requirements.txt ./
RUN pip install $PIP_FLAGS -r requirements.txt && pip install $PIP_FLAGS setuptools-scm
COPY emmet emmet
COPY emmet/api/_version.py emmet/api/_version.py
COPY setup.py .
RUN pip install $PIP_FLAGS -e .[server]
RUN wget -q https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && \
chmod +x wait-for-it.sh && mv wait-for-it.sh /root/.local/bin/
FROM base
COPY --from=builder /root/.local/lib/python3.9/site-packages /root/.local/lib/python3.9/site-packages
COPY --from=builder /root/.local/bin /root/.local/bin
COPY --from=builder /usr/lib/x86_64-linux-gnu/libsnappy* /usr/lib/x86_64-linux-gnu/
COPY --from=builder /emmet-api /emmet-api
WORKDIR /emmet-api
ARG VERSION
ENV PATH=/root/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
FLASK_APP=emmet-api \
FLASK_ENV=production \
PORT=10001 \
NUM_WORKERS=4 \
RELOAD="" \
MAX_REQUESTS=100000 \
MAX_REQUESTS_JITTER=10000 \
DD_TRACE_HOST=localhost:8126 \
DD_SERVICE=next-gen-api \
DD_ENV=prod \
DD_VERSION=$VERSION
COPY app.py .
COPY start.sh .
RUN chmod +x start.sh
LABEL com.datadoghq.ad.logs='[{"source": "gunicorn", "service": "next-gen-api"}]'
EXPOSE 10001 20001
CMD wait-for-it.sh $DD_TRACE_HOST -q -s -t 60 -- ./start.sh