forked from google/xls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-ubuntu-18.04
56 lines (42 loc) · 1.74 KB
/
Dockerfile-ubuntu-18.04
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
# NOTE: Ubuntu 18.04 environment support is best-effort only (and generally PRs
# # are accepted for build fixes that do not regress 20.04).
# Download base image ubuntu 18.04
FROM ubuntu:18.04
# LABEL about the custom image
LABEL version="0.1"
LABEL description="Docker Image for Building/Testing XLS on Ubuntu 18.04 x86-64"
# Update package info
RUN apt-get update -y
# Install Bazel
RUN apt-get install -y curl gnupg && \
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg && \
mv bazel.gpg /etc/apt/trusted.gpg.d/ && \
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list && \
apt-get update -y && apt-get install -y bazel
# Install dependencies
RUN apt-get -y install python3 python3-distutils python3-dev libtinfo5
# Install development tools
RUN apt-get install -y git vim
# Get a more modern toolchain (GCC 10)
RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
RUN apt-get update
RUN apt-get install -y gcc-10 g++-10
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
# Check we now have GCC 10.
RUN gcc --version
RUN useradd -m xls-developer
USER xls-developer
# Create "python" binary in PATH for Bazel Python environment.
# There is no python3-is-python as there is in 20.04 AFAICT.
RUN mkdir -p ~/opt/bin && \
ln -s $(which python3) ~/opt/bin/python
ENV PATH /home/xls-developer/opt/bin:$PATH
# Map the project contents in.
ADD --chown=xls-developer . /home/xls-developer/xls/
WORKDIR /home/xls-developer/xls/
# Build everything (opt)
RUN bazel build -c opt ...
# Test everything (opt)
RUN bazel test -c opt ...