• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Dockerfile to build a manylinux 2010 compliant cross-compiler.
2#
3# Builds a devtoolset gcc/libstdc++ that targets manylinux 2010 compatible
4# glibc (2.12) and system libstdc++ (4.4).
5#
6# To push a new version, run:
7# $ docker build -f Dockerfile.rbe.ubuntu16.04-manylinux2010 \
8#  --tag "gcr.io/tensorflow-testing/nosla-ubuntu16.04-manylinux2010" .
9# $ docker push gcr.io/tensorflow-testing/nosla-ubuntu16.04-manylinux2010
10
11FROM ubuntu:16.04 as devtoolset
12
13ENV DEBIAN_FRONTEND=noninteractive
14RUN apt-get update && apt-get install -y \
15      bzip2 \
16      cpio \
17      file \
18      flex \
19      g++ \
20      make \
21      patch \
22      rpm2cpio \
23      unar \
24      wget \
25      tar \
26      xz-utils \
27      && \
28    rm -rf /var/lib/apt/lists/*
29
30ADD devtoolset/fixlinks.sh fixlinks.sh
31ADD devtoolset/build_devtoolset.sh build_devtoolset.sh
32ADD devtoolset/rpm-patch.sh rpm-patch.sh
33
34# Set up a sysroot for glibc 2.12 / libstdc++ 4.4 / devtoolset-7 in /dt7.
35RUN /build_devtoolset.sh devtoolset-7 /dt7
36# Set up a sysroot for glibc 2.12 / libstdc++ 4.4 / devtoolset-8 in /dt8.
37RUN /build_devtoolset.sh devtoolset-8 /dt8
38
39# TODO(klimek): Split up into two different docker images.
40FROM ubuntu:16.04
41COPY --from=devtoolset /dt7 /dt7
42COPY --from=devtoolset /dt8 /dt8
43
44# Copy and run the install scripts.
45COPY install/*.sh /install/
46ARG DEBIAN_FRONTEND=noninteractive
47RUN /install/install_bootstrap_deb_packages.sh
48RUN /install/install_deb_packages.sh
49RUN /install/install_clang.sh
50RUN /install/install_bazel.sh
51
52# Install golang.
53RUN /install/install_golang.sh
54env GOROOT=/usr/local/go
55env PATH=$GOROOT/bin:$PATH
56
57# Install python 3.6.
58RUN yes "" | add-apt-repository ppa:deadsnakes/ppa
59RUN apt-get update && apt-get install -y \
60    python3.6 python3.6-dev python3-pip python3.6-venv && \
61    rm -rf /var/lib/apt/lists/* && \
62    python3.6 -m pip install pip --upgrade && \
63    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 0
64
65RUN /install/install_pip_packages.sh
66
67# Install python 3.8.
68RUN apt-get update && apt-get install -y python3.8 python3.8-dev python3.8-venv
69RUN rm -rf /var/lib/apt/lists/*
70# Have to download get-pip.py due to a pip circular issue
71# https://stackoverflow.com/questions/58758447/how-to-fix-module-platform-has-no-attribute-linux-distribution-when-instal
72RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
73RUN python3.8 get-pip.py
74RUN python3.8 -m pip install --upgrade pip setuptools wheel
75
76# Overwrite include paths that are generated for the multipython image.
77RUN ln -sf "/usr/include/x86_64-linux-gnu/python2.7" "/dt7/usr/include/x86_64-linux-gnu/python2.7"
78RUN ln -sf "/usr/include/x86_64-linux-gnu/python2.7" "/dt8/usr/include/x86_64-linux-gnu/python2.7"
79
80RUN ln -sf "/usr/include/x86_64-linux-gnu/python3.6m" "/dt7/usr/include/x86_64-linux-gnu/python3.6m"
81RUN ln -sf "/usr/include/x86_64-linux-gnu/python3.6m" "/dt8/usr/include/x86_64-linux-gnu/python3.6m"
82
83RUN ln -sf "/usr/include/x86_64-linux-gnu/python3.8" "/dt7/usr/include/x86_64-linux-gnu/python3.8"
84RUN ln -sf "/usr/include/x86_64-linux-gnu/python3.8" "/dt8/usr/include/x86_64-linux-gnu/python3.8"