forked from natlas/natlas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (36 loc) · 1.19 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
FROM node:15-stretch as webpack
ARG NATLAS_VERSION=unknown
WORKDIR /app
COPY ["package.json", "yarn.lock", "/app/"]
ENV NATLAS_VERSION=$NATLAS_VERSION
RUN yarn --no-progress --frozen-lockfile --non-interactive
COPY . /app
RUN yarn run webpack --mode production
FROM python:3.8 as build
COPY Pipfile .
COPY Pipfile.lock .
RUN pip install pipenv
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy \
&& rm -rf Pipfile Pipfile.lock
WORKDIR /opt/natlas/natlas-server
COPY . /opt/natlas/natlas-server
# Prepare assets
COPY --from=webpack /app/app/static/dist app/static/dist
RUN python3 -m compileall .
# Build final image
FROM python:3.8-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends libmariadb3 \
&& rm -rf /var/cache/* /root /var/lib/apt/info/* /var/lib/apt/lists/* /var/lib/ghc /var/lib/dpkg /var/lib/log/*
COPY --from=build /.venv /.venv
COPY --from=build /opt/natlas /opt/natlas
WORKDIR /opt/natlas/natlas-server/
VOLUME ["/data"]
ENV FLASK_APP=./natlas-server.py
ENV FLASK_ENV=production
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV PATH="/.venv/bin:$PATH"
EXPOSE 5000
ENTRYPOINT ["/bin/bash", "entrypoint.sh"]
CMD ["gunicorn", "-b", "0.0.0.0:5000", "natlas-server:app"]