-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (52 loc) · 2.39 KB
/
Copy pathDockerfile
File metadata and controls
58 lines (52 loc) · 2.39 KB
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
FROM materialsproject/devops:python-3.1113.15 AS base
RUN apt-get update && apt-get install -y --no-install-recommends supervisor libopenblas-dev libpq-dev vim && apt-get clean
WORKDIR /app
FROM base AS builder
RUN apt-get update && apt-get install -y --no-install-recommends gcc git g++ libsnappy-dev wget liblapack-dev && apt-get clean
ENV PIP_FLAGS "--no-cache-dir --compile"
COPY requirements/deployment.txt ./requirements.txt
RUN pip install $PIP_FLAGS -r requirements.txt
COPY pyproject.toml .
COPY mpcontribs mpcontribs
ARG CONTRIBS_VERSION
RUN SETUPTOOLS_SCM_PRETEND_VERSION=${CONTRIBS_VERSION} pip install $PIP_FLAGS --no-deps .
#ENV SETUPTOOLS_SCM_PRETEND_VERSION 0.0.0
#COPY marshmallow-mongoengine marshmallow-mongoengine
#RUN cd marshmallow-mongoengine && pip install $PIP_FLAGS --no-deps -e .
#COPY mimerender mimerender
#RUN cd mimerender && pip install $PIP_FLAGS --no-deps -e .
#COPY flask-mongorest flask-mongorest
#RUN cd flask-mongorest && pip install $PIP_FLAGS --no-deps -e .
#COPY AtlasQ AtlasQ
#RUN cd AtlasQ && pip install $PIP_FLAGS --no-deps -e .
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 /usr/local/bin/ && \
wget -q https://github.com/materialsproject/MPContribs/blob/master/mpcontribs-api/mpcontribs/api/contributions/formulae.json.gz?raw=true \
-O mpcontribs/api/contributions/formulae.json.gz
FROM base
ARG BUILDARCH
ENV BUILDARCH=x86_64
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /usr/lib/$BUILDARCH-linux-gnu/libsnappy* /usr/lib/$BUILDARCH-linux-gnu/
COPY --from=builder /app/mpcontribs/api /app/mpcontribs/api
WORKDIR /app
RUN mkdir -p /var/log/supervisor
COPY supervisord supervisord
COPY scripts scripts
COPY main.py .
COPY maintenance.py .
COPY docker-entrypoint.sh .
COPY gunicorn.conf.py .
RUN chmod +x main.py scripts/start.sh scripts/start_rq.sh docker-entrypoint.sh
ARG VERSION
ENV DD_SERVICE=contribs-apis \
DD_ENV=prod \
DD_VERSION=$VERSION \
DD_TRACE_HOST=localhost:8126 \
DD_TRACE_OTEL_ENABLED=false \
DD_MAIN_PACKAGE=mpcontribs-api
LABEL com.datadoghq.ad.logs='[{"source": "gunicorn", "service": "contribs-apis"}]'
EXPOSE 10000 10002 10003 10005 20000
ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "supervisord.conf"]