-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
77 lines (66 loc) · 2.07 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
72
73
74
75
76
77
# Multi stage build
FROM python:3.7-slim-buster AS builder
COPY entrypoint.sh /opt
COPY requirements.txt /opt
RUN apt-get update \
&& echo "debconf debconf/frontend select Noninteractive" | debconf-set-selections \
# install packages
&& apt-get -qq install --no-install-recommends \
gcc \
# required for download pypy
wget \
bzip2 \
libgraphviz-dev \
libc6-dev \
&& pip wheel \
--wheel-dir=/opt/wheelhouse \
-r /opt/requirements.txt \
# pypy install
&& wget -O /tmp/pypy.tar.bz2 https://bitbucket.org/pypy/pypy/downloads/pypy3.6-v7.2.0-linux64.tar.bz2 \
&& tar xjf /tmp/pypy.tar.bz2 -C /opt \
# && wget -O /tmp/im.tar.bz2 ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-7.0.9-2.tar.bz2 \
# && cd /opt/ImageMagick-7.0.9-2 \
# && ./configure --without-x --prefix=/opt/local \
# && make \
# && make install
# real 4m1.342s
&& echo "next"
# https://graphviz.gitlab.io/_pages/Download/Download_source.html
# ghostscript, pkg-config, swig
# skip smyrna
FROM python:3.7-slim-buster
# copy app in one layer
COPY --from=builder /opt /opt
RUN apt-get update \
&& echo "debconf debconf/frontend select Noninteractive" | debconf-set-selections \
# install packages
&& apt-get -qq install --no-install-recommends \
gcc \
g++ \
cmake \
make \
gosu \
# required for pypy
libtinfo5 \
# graphviz
graphviz \
imagemagick \
&& pip install --upgrade pip \
# install wheels
&& pip install \
--no-cache-dir \
--no-index \
--find-links=/opt/wheelhouse \
-r /opt/requirements.txt \
# link
&& ln -s /opt/pypy3.6-v7.2.0-linux64/bin/pypy3 /usr/local/bin \
&& chmod a+x /opt/entrypoint.sh \
# clean
&& rm -rf /opt/wheelhouse \
&& rm -rf /var/lib/apt/lists/* \
# add user
&& useradd -ms /bin/sh benchmarker
ENV PYTHONUNBUFFERED=1 \
PATH="${PATH}:/opt/benchmark"
ENTRYPOINT [ "/opt/entrypoint.sh" ]
CMD ["sleep", "infinity"]