Skip to content

Commit

Permalink
Don't build python for no reason. Copy it (#1690)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmetzman authored Feb 8, 2023
1 parent 6ca6757 commit baacfa6
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions docker/benchmark-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

ARG parent_image

# Using multi-stage build to copy latest Python 3.
FROM gcr.io/fuzzbench/base-image AS base-image

FROM $parent_image

ARG fuzzer
Expand All @@ -24,36 +27,26 @@ ENV FUZZER $fuzzer
ENV BENCHMARK $benchmark
ENV DEBUG_BUILDER $debug_builder

# Python 3.10.8 is not the default version in Ubuntu 20.04 (Focal Fossa).
ENV PYTHON_VERSION 3.10.8

# Install dependencies required by Python3 or Pip3.
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
curl \
xz-utils \
build-essential \
zlib1g-dev \
libssl-dev \
libffi-dev

RUN cd /tmp/ && \
curl -O \
https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz && \
tar -xvf Python-$PYTHON_VERSION.tar.xz > /dev/null && \
cd Python-$PYTHON_VERSION && \
./configure \
--enable-loadable-sqlite-extensions \
--enable-optimizations \
> /dev/null && \
make -j install > /dev/null && \
rm -r /tmp/Python-$PYTHON_VERSION.tar.xz /tmp/Python-$PYTHON_VERSION

# Install common python dependencies.
COPY ./requirements.txt /tmp
RUN pip3 install -r /tmp/requirements.txt
RUN rm -rf /usr/local/bin/python3.8* /usr/local/bin/pip3 /usr/local/lib/python3.8 \
/usr/local/include/python3.8 /usr/local/lib/python3.8/site-packages

# Copy latest python3 from base-image into local.
COPY --from=base-image /usr/local/bin/python3* /usr/local/bin/
COPY --from=base-image /usr/local/bin/pip3* /usr/local/bin/
COPY --from=base-image /usr/local/lib/python3.10 /usr/local/lib/python3.10
COPY --from=base-image /usr/local/include/python3.10 /usr/local/include/python3.10
COPY --from=base-image /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages

# Copy the entire fuzzers directory tree to allow for module dependencies.
COPY fuzzers $SRC/fuzzers
Expand Down

0 comments on commit baacfa6

Please sign in to comment.