Skip to content

Instantly share code, notes, and snippets.

@TerrorJack
Created August 26, 2017 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TerrorJack/3ff83fe5f22acb8be8525c6c1d6235e7 to your computer and use it in GitHub Desktop.
Save TerrorJack/3ff83fe5f22acb8be8525c6c1d6235e7 to your computer and use it in GitHub Desktop.
ghc-head.Dockerfile
# docker build --build-arg http_proxy=http://10.0.75.1:8010 --build-arg https_proxy=http://10.0.75.1:8010 .
FROM ubuntu:zesty
RUN apt update
RUN apt install -y software-properties-common
RUN add-apt-repository -y ppa:git-core/candidate
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
RUN apt update
RUN apt upgrade -y
RUN apt install -y autoconf automake curl gcc-7 git libffi-dev libgmp-dev make ncurses-dev netbase zlib1g-dev
RUN apt autoremove -y
RUN apt clean -y
ENV CC /usr/bin/gcc-7
ENV CPP /usr/bin/cpp-7
ENV LD /usr/bin/ld.gold
RUN curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3-latest-Linux-x86_64.sh
RUN chmod +x Miniconda3-latest-Linux-x86_64.sh
RUN ./Miniconda3-latest-Linux-x86_64.sh -b
RUN rm Miniconda3-latest-Linux-x86_64.sh
ENV PATH /root/miniconda3/bin:$PATH
RUN conda update -y --all
RUN conda install -y sphinx
RUN conda clean -y --all
RUN mkdir -p /root/.local/bin
ENV PATH /root/.local/bin:$PATH
RUN curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C /root/.local/bin '*/stack'
RUN stack --resolver nightly --install-ghc install alex happy hscolour
RUN rm `stack path --programs`/*.tar.xz
RUN git clone --recursive https://git.haskell.org/ghc.git
WORKDIR ghc
RUN ./boot
RUN printf "SRC_HC_OPTS = -O -H64m\nGhcStage1HcOpts = -O\nGhcStage2HcOpts = -O2\nGhcLibHcOpts = -O2\nBUILD_PROF_LIBS = NO\nHADDOCK_DOCS = YES\nEXTRA_HADDOCK_OPTS += --hyperlinked-source\nBUILD_SPHINX_HTML = YES\n" > mk/build.mk
RUN ver_posixtime=`git log -1 --pretty=format:%ct` printf 8.3.`perl -MPOSIX -e "print strftime('%Y%m%d', gmtime($ver_posixtime));"` > version.txt
RUN ./configure --prefix=`stack path --programs`/ghc-`cat version.txt` --with-ghc=`stack path --compiler-exe` --with-system-libffi
RUN make
RUN make install
WORKDIR /root
RUN rm -rf ghc
RUN cp `stack path --programs`/ghc-8.2.1.installed `stack path --programs`/ghc-`cat version.txt`.installed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment