Commit f3626b4d authored by Marian Heil's avatar Marian Heil

Docker for gcc with Ubuntu

parent 6a9e0754
#!/bin/bash
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
#!/bin/bash
. /cvmfs/pheno.egi.eu/HEJ/main_env.sh
FROM ubuntu AS base
LABEL name "compilerenv"
# RUN yum -y install tar wget file which cmake3 deltarpm make && yum -y update && yum clean all
RUN apt-get -y update && apt-get -y install tar wget file cmake deltarpm make python
# installing tzdata needs timezone
RUN export DEBIAN_FRONTEND=noninteractive && apt-get -y install tzdata \
&& ln -fs /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime \
&& dpkg-reconfigure --frontend noninteractive tzdata
ENV MAIN_PREFIX /cvmfs/pheno.egi.eu/HEJ
COPY .bash_profile /root/.bash_profile
COPY .bashrc /root/.bashrc
COPY main_env.sh $MAIN_PREFIX/main_env.sh
ENV GCC_PREFIX $MAIN_PREFIX/gcc_9
# Build docker
FROM base AS builder
# RUN . /root/.bashrc && yum -y update \
# && yum -y install xz bzip2 gcc-c++ zlib-devel tcl expect dejagnu binutils git \
# && yum clean all
RUN . /root/.bashrc \
&& apt-get -y install bzip2 tcl expect dejagnu binutils xz-utils build-essential
ENV T_GCC_VERSION 9.2.0
ENV LANG C.UTF-8
# Install gcc
WORKDIR /usr/tmp/
RUN wget -O- ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-${T_GCC_VERSION}/gcc-${T_GCC_VERSION}.tar.xz | tar Jx
WORKDIR /usr/tmp/gcc-$T_GCC_VERSION
RUN . /root/.bashrc && ./contrib/download_prerequisites
WORKDIR /usr/tmp/objdir
RUN . /root/.bashrc && /usr/tmp/gcc-$T_GCC_VERSION/configure --prefix=$GCC_PREFIX --disable-multilib
RUN . /root/.bashrc && make -j $(nproc --ignore=1) bootstrap
RUN . /root/.bashrc && make install
RUN . /root/.bashrc && rm -rf /usr/tmp/*
ENV CC $GCC_PREFIX/bin/gcc
ENV CXX $GCC_PREFIX/bin/g++
ENV PATH $GCC_PREFIX/bin:$PATH
ENV LD_LIBRARY_PATH $GCC_PREFIX/lib64:$GCC_PREFIX/lib
# create env. file
WORKDIR $GCC_PREFIX
COPY gccenv.sh $GCC_PREFIX/gccenv.sh
RUN . /root/.bashrc && sed -i -e "s GCC_PREFIX ${GCC_PREFIX} g" gccenv.sh
RUN . /root/.bashrc && printf 'source '$GCC_PREFIX'/gccenv.sh\n' >> $MAIN_PREFIX/main_env.sh
# Final docker
FROM base
ENV CC $GCC_PREFIX/bin/gcc
ENV CXX $GCC_PREFIX/bin/g++
ENV PATH $GCC_PREFIX/bin:$PATH
ENV LD_LIBRARY_PATH $GCC_PREFIX/lib64:$GCC_PREFIX/lib
COPY --from=builder $GCC_PREFIX $GCC_PREFIX
COPY --from=builder $MAIN_PREFIX/main_env.sh $MAIN_PREFIX/main_env.sh
#!/bin/bash
export GCC_ROOT_DIR=GCC_PREFIX
export GCC_INCLUDEDIR=${GCC_ROOT_DIR}/include
export GCC_LIBRARYDIR=${GCC_ROOT_DIR}/lib
export GCC_LIBRARYDIR64=${GCC_ROOT_DIR}/lib64
export LD_LIBRARY_PATH=${GCC_LIBRARYDIR}:${GCC_LIBRARYDIR64}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export PATH=${GCC_ROOT_DIR}/bin${PATH:+:${PATH}}
export CC=${GCC_ROOT_DIR}/bin/gcc
export CXX=${GCC_ROOT_DIR}/bin/g++
#!/bin/bash
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment