forked from RasaHQ/rasa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (57 loc) · 1.56 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
FROM python:3.6-slim as base
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends \
# required by psycopg2 at build and runtime
libpq-dev \
# required for health check
curl \
&& apt-get autoremove -y
FROM base as builder
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
build-essential \
wget \
openssh-client \
graphviz-dev \
pkg-config \
git-core \
openssl \
libssl-dev \
libffi6 \
libffi-dev \
libpng-dev
# install poetry
# keep this in sync with the version in pyproject.toml and Dockerfile
ENV POETRY_VERSION 1.0.3
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
ENV PATH "/root/.poetry/bin:/opt/venv/bin:${PATH}"
# copy files
COPY . /build/
# change working directory
WORKDIR /build
# install dependencies
RUN python -m venv /opt/venv && \
. /opt/venv/bin/activate && \
pip install --no-cache-dir -U 'pip<20' && \
poetry install --no-dev --no-root --no-interaction && \
poetry build -f wheel -n && \
pip install --no-deps dist/*.whl && \
rm -rf dist *.egg-info
# start a new build stage
FROM base as runner
# copy everything from /opt
COPY --from=builder /opt/venv /opt/venv
# make sure we use the virtualenv
ENV PATH="/opt/venv/bin:$PATH"
# update permissions & change user to not run as root
WORKDIR /app
RUN chgrp -R 0 /app && chmod -R g=u /app
USER 1001
# create a volume for temporary data
VOLUME /tmp
# change shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# the entry point
EXPOSE 5005
ENTRYPOINT ["rasa"]
CMD ["--help"]