-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
66 lines (54 loc) · 1.2 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
# inspired by https://sourcery.ai/blog/python-docker/
FROM ubuntu:20.04 as base
ENV LC_ALL C.UTF-8
# no .pyc files
ENV PYTHONDONTWRITEBYTECODE 1
# traceback on segfau8t
ENV PYTHONFAULTHANDLER 1
# use ipdb for breakpoints
ENV PYTHONBREAKPOINT=ipdb.set_trace
# common dependencies
RUN apt-get update -q \
&& DEBIAN_FRONTEND="noninteractive" \
apt-get install -yq \
# git-state
git \
\
# primary interpreter
python3.9 \
\
# for shelve
python3.9-gdb \
\
# redis-python
redis \
\
# for ray
rsync \
\
&& apt-get clean
FROM base AS python-deps
# build dependencies
RUN apt-get update -q \
&& DEBIAN_FRONTEND="noninteractive" \
apt-get install -yq \
\
# required by poetry
python3-pip \
\
# required for redis
gcc \
\
&& apt-get clean
WORKDIR "/deps"
COPY pyproject.toml poetry.lock typing-extensions.lock patch.py /deps/
RUN pip3 install poetry tomli tomli-w \
&& python3 patch.py \
&& poetry install
FROM base AS runtime
WORKDIR "/root"
ENV VIRTUAL_ENV=/root/.cache/pypoetry/virtualenvs/icpi-K3BlsyQa-py3.9
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=python-deps $VIRTUAL_ENV $VIRTUAL_ENV
COPY . .
ENTRYPOINT ["python"]