Skip to content
Snippets Groups Projects
Commit e92b8ce1 authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

feat: move to Dockerfile heredoc

parent 196c15b0
No related branches found
No related tags found
1 merge request!758feat: move to Dockerfile heredoc
...@@ -18,12 +18,12 @@ ENV CLICOLOR_FORCE=1 \ ...@@ -18,12 +18,12 @@ ENV CLICOLOR_FORCE=1 \
## Install additional packages. Remove the auto-cleanup functionality ## Install additional packages. Remove the auto-cleanup functionality
## for docker, as we're using the new buildkit cache instead. ## for docker, as we're using the new buildkit cache instead.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked <<EOF
rm -f /etc/apt/apt.conf.d/docker-clean \ rm -f /etc/apt/apt.conf.d/docker-clean
&& ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime \ ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
&& echo "US/Eastern" > /etc/timezone \ echo "US/Eastern" > /etc/timezone
&& apt-get -yqq update \ apt-get -yqq update
&& apt-get -yqq install --no-install-recommends \ apt-get -yqq install --no-install-recommends \
bc \ bc \
bzip2 \ bzip2 \
ca-certificates \ ca-certificates \
...@@ -53,50 +53,40 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ ...@@ -53,50 +53,40 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
time \ time \
unzip \ unzip \
vim-nox \ vim-nox \
wget \ wget
&& apt-get -yqq autoremove \ apt-get -yqq autoremove
&& localedef -i en_US -f UTF-8 en_US.UTF-8 localedef -i en_US -f UTF-8 en_US.UTF-8
EOF
# Install updated compilers, with support for multiple base images # Install updated compilers, with support for multiple base images
## Ubuntu: latest gcc from toolchain ppa, latest stable clang ## Ubuntu: latest gcc from toolchain ppa, latest stable clang
## Debian: default gcc with distribution, latest stable clang ## Debian: default gcc with distribution, latest stable clang
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked <<EOF
. /etc/os-release \ . /etc/os-release
&& mkdir -p /etc/apt/source.list.d \ mkdir -p /etc/apt/source.list.d
&& if [ "${ID}" = "ubuntu" ] ; then \ if [ "${ID}" = "ubuntu" ] ; then
echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu/ \ echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu/${VERSION_CODENAME} main" > /etc/apt/source.list.d/ubuntu-toolchain.list
${VERSION_CODENAME} main" \ if [ "${VERSION_ID}" = "20.04" ] ; then GCC="-10" CLANG="-12" ; fi
> /etc/apt/source.list.d/ubuntu-toolchain.list \ if [ "${VERSION_ID}" = "22.04" ] ; then GCC="-12" CLANG="-14" ; fi
&& if [ "${VERSION_ID}" = "20.04" ] ; then GCC="-10" CLANG="-12" ; fi\ curl -s https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
&& if [ "${VERSION_ID}" = "22.04" ] ; then GCC="-12" CLANG="-14" ; fi\ echo "deb http://apt.llvm.org/${VERSION_CODENAME} llvm-toolchain-${VERSION_CODENAME}${CLANG} main" > /etc/apt/source.list.d/llvm.list
&& curl -s https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -\ apt-get -yqq update
&& echo "deb http://apt.llvm.org/${VERSION_CODENAME} \ apt-get -yqq install gcc${GCC} g++${GCC} gfortran${GCC}
llvm-toolchain-${VERSION_CODENAME}${CLANG} main" \ apt-get -yqq install clang${CLANG} clang-tidy${CLANG} clang-format${CLANG}
> /etc/apt/source.list.d/llvm.list \ apt-get -yqq install iwyu
&& apt-get -yqq update \ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc${GCC} 100
&& apt-get -yqq install \ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++${GCC} 100
gcc${GCC} g++${GCC} gfortran${GCC} \ update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran${GCC} 100
&& apt-get -yqq install \ update-alternatives --install /usr/bin/clang clang /usr/bin/clang${CLANG} 100
clang${CLANG} clang-tidy${CLANG} clang-format${CLANG} \ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++${CLANG} 100
iwyu \ else
&& update-alternatives --install /usr/bin/gcc gcc \ apt-get -yqq update
/usr/bin/gcc${GCC} 100 \ apt-get -yqq install gcc g++ gfortran
&& update-alternatives --install /usr/bin/g++ g++ \ apt-get -yqq install clang clang-tidy clang-format
/usr/bin/g++${GCC} 100 \ apt-get -yqq install iwyu
&& update-alternatives --install /usr/bin/gfortran gfortran \ fi
/usr/bin/gfortran${GCC} 100 \ apt-get -yqq autoremove
&& update-alternatives --install /usr/bin/clang clang \ gcc --version
/usr/bin/clang${CLANG} 100 \ clang --version
&& update-alternatives --install /usr/bin/clang++ clang++ \ EOF
/usr/bin/clang++${CLANG} 100 \
; else \
apt-get -yqq update \
&& apt-get -yqq install \
gcc g++ gfortran \
clang clang-tidy clang-format \
iwyu \
; fi \
&& apt-get -yqq autoremove \
&& gcc --version \
&& clang --version
This diff is collapsed.
...@@ -17,8 +17,7 @@ ARG jobs=8 ...@@ -17,8 +17,7 @@ ARG jobs=8
## the date ## the date
ARG JUG_VERSION=1 ARG JUG_VERSION=1
RUN cd /tmp \ RUN echo " - jug_xl: ${JUG_VERSION}" >> /etc/jug_info
&& echo " - jug_xl: ${JUG_VERSION}" >> /etc/jug_info
## also install detector/ip geometries into opt ## also install detector/ip geometries into opt
ARG NIGHTLY='' ARG NIGHTLY=''
...@@ -31,11 +30,11 @@ ADD https://api.github.com/repos/eic/ip6 /tmp/ip6.json ...@@ -31,11 +30,11 @@ ADD https://api.github.com/repos/eic/ip6 /tmp/ip6.json
ADD https://api.github.com/repos/eic/epic /tmp/epic.json ADD https://api.github.com/repos/eic/epic /tmp/epic.json
COPY setup_detectors.py /tmp COPY setup_detectors.py /tmp
COPY --from=detectors detectors.yaml /tmp COPY --from=detectors detectors.yaml /tmp
RUN --mount=type=cache,target=/ccache/,sharing=locked,id=${TARGETPLATFORM} \ RUN --mount=type=cache,target=/ccache/,sharing=locked,id=${TARGETPLATFORM} <<EOF
cd /tmp \ cd /tmp
&& export CCACHE_DIR=/ccache \ export CCACHE_DIR=/ccache
&& [ "z$NIGHTLY" = "z1" ] && NIGHTLY_FLAG="--nightly" || NIGHTLY_FLAG="" \ [ "z$NIGHTLY" = "z1" ] && NIGHTLY_FLAG="--nightly" || NIGHTLY_FLAG=""
&& /tmp/setup_detectors.py --prefix /opt/detector --config /tmp/detectors.yaml \ /tmp/setup_detectors.py --prefix /opt/detector --config /tmp/detectors.yaml $NIGHTLY_FLAG
$NIGHTLY_FLAG \ ccache --show-stats
&& ccache --show-stats \ rm /tmp/setup_detectors.py
&& rm /tmp/setup_detectors.py EOF
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment