[ci] Update Dockerfile to use Ubuntu 18.04 instead of 16.04

Also add parameter to pick specific versions of Ubuntu.
This commit is contained in:
Eduardo Salinas 2022-04-28 19:07:41 -04:00 коммит произвёл GitHub
Родитель e6a1a8fda7
Коммит b9d6ae1d9b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 30 добавлений и 19 удалений

Просмотреть файл

@ -1,4 +1,7 @@
FROM ubuntu:16.04
ARG UBUNTU_VERSION=18.04
FROM ubuntu:$UBUNTU_VERSION
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG UBUNTU_VERSION
# Cache folders
VOLUME /root/.ccache /root/.stack
@ -34,19 +37,6 @@ RUN apt-get -y install \
clang \
cmake
# Components for Haskell. See https://docs.haskellstack.org/en/stable/install_and_upgrade/#linux
RUN wget -qO- https://get.haskellstack.org/ | sh
# Components for C#. See http://www.mono-project.com/download/#download-lin
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
echo "deb https://download.mono-project.com/repo/ubuntu xenial main" | tee /etc/apt/sources.list.d/mono-official.list && \
apt-get update && \
apt-get -y install \
mono-devel \
nuget \
referenceassemblies-pcl
RUN nuget install NUnit.ConsoleRunner -OutputDirectory /root -Version 3.8.0 -NonInteractive -ExcludeVersion
# Components for Java
RUN add-apt-repository ppa:cwchien/gradle && \
apt-get update && \
@ -54,6 +44,9 @@ RUN add-apt-repository ppa:cwchien/gradle && \
gradle-6.8.3 \
openjdk-8-jdk-headless
# Components for Haskell. See https://docs.haskellstack.org/en/stable/install_and_upgrade/#linux
RUN wget -qO- https://get.haskellstack.org/ | sh
# Components for ghc
RUN add-apt-repository ppa:hvr/ghc -y && \
apt-get update && \
@ -64,5 +57,23 @@ RUN add-apt-repository ppa:git-core/ppa -y && \
apt-get update && \
apt-get install --no-install-recommends git -y
# we need to set bash to be able to use if statement
SHELL ["/bin/bash", "-c"]
# Components for C#. See http://www.mono-project.com/download/#download-lin
RUN if [ "$UBUNTU_VERSION" = "18.04" ] || [ "$UBUNTU_VERSION" = "20.04" ] ; then apt install gnupg ca-certificates; fi
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
RUN if [[ "$UBUNTU_VERSION" = "16.04" ]] ; then echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main"; \
elif [[ "$UBUNTU_VERSION" = "18.04" ]] ; then echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main"; \
elif [[ "$UBUNTU_VERSION" = "20.04" ]] ; then echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main"; fi \
| tee /etc/apt/sources.list.d/mono-official.list && apt-get update && apt-get -y install \
mono-devel \
nuget \
referenceassemblies-pcl
RUN nuget install NUnit.ConsoleRunner -OutputDirectory /root -Version 3.8.0 -NonInteractive -ExcludeVersion
# Build script
ENTRYPOINT ["zsh", "/root/bond/tools/ci-scripts/linux/build.zsh"]

Просмотреть файл

@ -3,7 +3,7 @@
This directory contains the source for a Docker image that is used for
building Bond.
The image is based on Ubuntu 16.04 (Xenial Xerus) and contains:
The image is based on Ubuntu 18.04 (Bionic Beaver) and contains:
* pre-installed build tools for the various languages Bond supports,
* binaries of a number of Boost versions for the C++ and Python builds, and
@ -15,7 +15,7 @@ The image is based on Ubuntu 16.04 (Xenial Xerus) and contains:
A new image is automatically built when the master branch of the main Bond
repository (https://github.com/microsoft/bond) is changed. These images are
then pushed to the bondciimages.azurecr.io/ubuntu-1604 container repository.
then pushed to the bondciimages.azurecr.io/ubuntu-1804 (also bondciimages.azurecr.io/ubuntu-1604) container repository.
The Travis CI builds pull a fixed version of the image specified in
`.travis.yml` and use that.
@ -56,7 +56,7 @@ zsh is only needed to debug and work on `build_boost.zsh` locally.
To create the image, start in the directory containing this README and run:
$ docker build -t bond-ubuntu-1604 .
$ docker build --no-cache -t bond-ubuntu-1804 --build-arg UBUNTU_VERSION="18.04"
This will make the Docker image with all the required dependencies and will
compile all the required versions of Boost (using the `build_boosts.zsh`
@ -64,7 +64,7 @@ script) that will become part of the image.
The build takes about 20 minutes on a quad-core 3.3 GHz Skylake Xeon. When
it finishes, there will be a new Docker image with the tag
`bond-ubuntu-1604` in your collection of Docker images:
`bond-ubuntu-1804` in your collection of Docker images:
$ docker images
@ -74,7 +74,7 @@ You can build Bond inside the container:
$ docker run \
-v path/to/your/bond/repository:/root/bond \
bond-ubuntu-1604 \
bond-ubuntu-1804 \
~ \
cpp-core \
1.64.0 \