forked from taranis-ai/taranis-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.core
49 lines (36 loc) · 1.21 KB
/
Dockerfile.core
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
FROM python:3-slim as builder
WORKDIR /app/
# install common packages
RUN apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y \
libpq-dev \
curl \
openssl \
build-essential \
python3-dev
COPY ./src/core/. /app/
RUN python3 -m venv /app/.venv && \
export PATH="/app/.venv/bin:$PATH" && \
pip install --no-cache-dir --upgrade pip wheel && \
pip install --no-cache-dir -e /app/
FROM python:3-slim
WORKDIR /app/
RUN groupadd user && useradd --home-dir /app -g user user && chown -R user:user /app
RUN apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y \
libpq-dev \
curl \
openssl
RUN install -d -o user -g user /app/data
COPY --from=builder --chown=user:user /app/.venv /app/.venv
COPY --chown=user:user ./src/core/. /app/
COPY --chown=user:user ./docker/gunicorn.conf.py /app/
USER user
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONPATH=/app
ARG git_info
ENV GIT_INFO=${git_info:-'{}'}
RUN echo BUILD_DATE=$(date --iso-8601=minutes) > .env
ENV DATA_FOLDER=/app/data
VOLUME ["/app/data"]
EXPOSE 80
HEALTHCHECK --interval=60s --timeout=3s --retries=5 CMD curl --fail http://localhost/api/isalive || exit 1
CMD ["gunicorn"]