14
14
15
15
ARG parent_image
16
16
17
+ # Using multi-stage build to copy latest Python 3.
18
+ FROM gcr.io/fuzzbench/base-image AS base-image
19
+
17
20
FROM $parent_image
18
21
19
22
ARG fuzzer
@@ -24,36 +27,26 @@ ENV FUZZER $fuzzer
24
27
ENV BENCHMARK $benchmark
25
28
ENV DEBUG_BUILDER $debug_builder
26
29
27
- # Python 3.10.8 is not the default version in Ubuntu 20.04 (Focal Fossa).
28
- ENV PYTHON_VERSION 3.10.8
29
30
30
31
# Install dependencies required by Python3 or Pip3.
31
32
RUN apt-get update && \
32
33
apt-get upgrade -y && \
33
34
apt-get install -y \
34
35
curl \
35
36
xz-utils \
36
- build-essential \
37
37
zlib1g-dev \
38
38
libssl-dev \
39
39
libffi-dev
40
40
41
- RUN cd /tmp/ && \
42
- curl -O \
43
- https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz && \
44
- tar -xvf Python-$PYTHON_VERSION.tar.xz > /dev/null && \
45
- cd Python-$PYTHON_VERSION && \
46
- ./configure \
47
- --enable-loadable-sqlite-extensions \
48
- --enable-optimizations \
49
- > /dev/null && \
50
- make -j install > /dev/null && \
51
- rm -r /tmp/Python-$PYTHON_VERSION.tar.xz /tmp/Python-$PYTHON_VERSION
52
-
53
- # Install common python dependencies.
54
- COPY ./requirements.txt /tmp
55
- RUN pip3 install -r /tmp/requirements.txt
41
+ RUN rm -rf /usr/local/bin/python3.8* /usr/local/bin/pip3 /usr/local/lib/python3.8 \
42
+ /usr/local/include/python3.8 /usr/local/lib/python3.8/site-packages
56
43
44
+ # Copy latest python3 from base-image into local.
45
+ COPY --from=base-image /usr/local/bin/python3* /usr/local/bin/
46
+ COPY --from=base-image /usr/local/bin/pip3* /usr/local/bin/
47
+ COPY --from=base-image /usr/local/lib/python3.10 /usr/local/lib/python3.10
48
+ COPY --from=base-image /usr/local/include/python3.10 /usr/local/include/python3.10
49
+ COPY --from=base-image /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
57
50
58
51
# Copy the entire fuzzers directory tree to allow for module dependencies.
59
52
COPY fuzzers $SRC/fuzzers
0 commit comments