1# Dockerfile for running fuzzing tests on linux32.
2#
3# This is a temporary workaround for bugs in clang that make it incompatible
4# with Ubuntu 18.04 (see bug 1488148). This image can be removed once a new
5# release of LLVM includes the necessary fixes.
6
7FROM ubuntu:16.04
8LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
9
10RUN dpkg --add-architecture i386
11RUN apt-get update \
12 && apt-get install -y --no-install-recommends \
13    apt-transport-https \
14    apt-utils \
15    build-essential \
16    ca-certificates \
17    curl \
18    g++-multilib \
19    git \
20    gyp \
21    libssl-dev \
22    libssl-dev:i386 \
23    libxml2-utils \
24    lib32z1-dev \
25    linux-libc-dev:i386 \
26    locales \
27    mercurial \
28    ninja-build \
29    pkg-config \
30    software-properties-common \
31    valgrind \
32    zlib1g-dev \
33 && rm -rf /var/lib/apt/lists/* \
34 && apt-get autoremove -y && apt-get clean -y
35
36# Install clang and tools from the LLVM PPA.
37RUN curl -sf https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
38 && apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main" \
39 && apt-get update \
40 && apt-get install -y --no-install-recommends \
41    clang-6.0 \
42    clang-tools-6.0 \
43    llvm-6.0-dev \
44 && rm -rf /var/lib/apt/lists/* \
45 && apt-get autoremove -y && apt-get clean -y
46
47# Alias all the clang commands.
48RUN for i in $(dpkg -L clang-6.0 clang-tools-6.0 | grep '^/usr/bin/' | xargs -i basename {} -6.0); do \
49      update-alternatives --install "/usr/bin/$i" "$i" "/usr/bin/${i}-6.0" 10; \
50    done
51
52ENV SHELL /bin/bash
53ENV USER worker
54ENV LOGNAME $USER
55ENV HOME /home/$USER
56ENV LANG en_US.UTF-8
57ENV LC_ALL $LANG
58ENV HOST localhost
59ENV DOMSUF localdomain
60
61RUN locale-gen $LANG \
62 && DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
63
64RUN useradd -d $HOME -s $SHELL -m $USER
65WORKDIR $HOME
66
67# Add build and test scripts.
68ADD bin $HOME/bin
69RUN chmod +x $HOME/bin/*
70
71# Change user.
72USER $USER
73
74# Set a default command for debugging.
75CMD ["/bin/bash", "--login"]
76