diff --git a/8.4/buster/Dockerfile b/8.4/buster/Dockerfile new file mode 100644 index 0000000..eeb86e4 --- /dev/null +++ b/8.4/buster/Dockerfile @@ -0,0 +1,24 @@ +## Dockerfile for a haskell environment +FROM buildpack-deps:buster + +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git && \ + echo 'deb http://downloads.haskell.org/debian buster main' > /etc/apt/sources.list.d/ghc.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ + apt-get update && \ + apt-get install -y --no-install-recommends ghc-8.4.4 cabal-install-3.0 \ + ghc-8.4.4-prof libtinfo-dev && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ + tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ + /usr/local/bin/stack config set system-ghc --global true && \ + /usr/local/bin/stack config set install-ghc --global false && \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH + +## run ghci by default unless a command is specified +CMD ["ghci"] diff --git a/8.4/buster/slim/Dockerfile b/8.4/buster/slim/Dockerfile new file mode 100644 index 0000000..63f85f7 --- /dev/null +++ b/8.4/buster/slim/Dockerfile @@ -0,0 +1,24 @@ +## Dockerfile for a haskell environment +FROM debian:buster + +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git && \ + echo 'deb http://downloads.haskell.org/debian buster main' > /etc/apt/sources.list.d/ghc.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ + apt-get update && \ + apt-get install -y --no-install-recommends ghc-8.4.4 cabal-install-3.0 \ + zlib1g-dev libtinfo-dev libsqlite3-dev g++ netbase xz-utils make && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ + tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ + /usr/local/bin/stack config set system-ghc --global true && \ + /usr/local/bin/stack config set install-ghc --global false && \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH + +## run ghci by default unless a command is specified +CMD ["ghci"] diff --git a/8.4/stretch/Dockerfile b/8.4/stretch/Dockerfile new file mode 100644 index 0000000..c766a2a --- /dev/null +++ b/8.4/stretch/Dockerfile @@ -0,0 +1,24 @@ +## Dockerfile for a haskell environment +FROM buildpack-deps:stretch + +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git && \ + echo 'deb http://downloads.haskell.org/debian stretch main' > /etc/apt/sources.list.d/ghc.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ + apt-get update && \ + apt-get install -y --no-install-recommends ghc-8.4.4 cabal-install-3.0 \ + ghc-8.4.4-prof libtinfo-dev && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ + tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ + /usr/local/bin/stack config set system-ghc --global true && \ + /usr/local/bin/stack config set install-ghc --global false && \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH + +## run ghci by default unless a command is specified +CMD ["ghci"] diff --git a/8.4/Dockerfile b/8.4/stretch/slim/Dockerfile similarity index 61% rename from 8.4/Dockerfile rename to 8.4/stretch/slim/Dockerfile index 61222ef..f498973 100644 --- a/8.4/Dockerfile +++ b/8.4/stretch/slim/Dockerfile @@ -9,19 +9,16 @@ RUN apt-get update && \ echo 'deb http://downloads.haskell.org/debian stretch main' > /etc/apt/sources.list.d/ghc.list && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ apt-get update && \ - apt-get install -y --no-install-recommends ghc-8.4.4 cabal-install-2.4 \ + apt-get install -y --no-install-recommends ghc-8.4.4 cabal-install-3.0 \ zlib1g-dev libtinfo-dev libsqlite3-dev g++ netbase xz-utils make && \ - curl -fSL https://github.com/commercialhaskell/stack/releases/download/v1.9.1/stack-1.9.1-linux-x86_64.tar.gz -o stack.tar.gz && \ - curl -fSL https://github.com/commercialhaskell/stack/releases/download/v1.9.1/stack-1.9.1-linux-x86_64.tar.gz.asc -o stack.tar.gz.asc && \ - export GNUPGHOME="$(mktemp -d)" && \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys C5705533DA4F78D8664B5DC0575159689BEFB442 && \ - gpg --batch --verify stack.tar.gz.asc stack.tar.gz && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ /usr/local/bin/stack config set system-ghc --global true && \ /usr/local/bin/stack config set install-ghc --global false && \ - rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz.asc /stack.tar.gz + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz -ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/2.4/bin:/opt/ghc/8.4.4/bin:$PATH +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH ## run ghci by default unless a command is specified CMD ["ghci"] diff --git a/8.6/buster/Dockerfile b/8.6/buster/Dockerfile new file mode 100644 index 0000000..35e6530 --- /dev/null +++ b/8.6/buster/Dockerfile @@ -0,0 +1,24 @@ +## Dockerfile for a haskell environment +FROM buildpack-deps:buster + +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git && \ + echo 'deb http://downloads.haskell.org/debian buster main' > /etc/apt/sources.list.d/ghc.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ + apt-get update && \ + apt-get install -y --no-install-recommends ghc-8.6.5 cabal-install-3.0 \ + ghc-8.6.5-prof libtinfo-dev && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ + tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ + /usr/local/bin/stack config set system-ghc --global true && \ + /usr/local/bin/stack config set install-ghc --global false && \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH + +## run ghci by default unless a command is specified +CMD ["ghci"] diff --git a/8.6/buster/slim/Dockerfile b/8.6/buster/slim/Dockerfile new file mode 100644 index 0000000..2e49b19 --- /dev/null +++ b/8.6/buster/slim/Dockerfile @@ -0,0 +1,24 @@ +## Dockerfile for a haskell environment +FROM debian:buster + +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git && \ + echo 'deb http://downloads.haskell.org/debian buster main' > /etc/apt/sources.list.d/ghc.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ + apt-get update && \ + apt-get install -y --no-install-recommends ghc-8.6.5 cabal-install-3.0 \ + zlib1g-dev libtinfo-dev libsqlite3-dev g++ netbase xz-utils make && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ + tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ + /usr/local/bin/stack config set system-ghc --global true && \ + /usr/local/bin/stack config set install-ghc --global false && \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH + +## run ghci by default unless a command is specified +CMD ["ghci"] diff --git a/8.6/stretch/Dockerfile b/8.6/stretch/Dockerfile new file mode 100644 index 0000000..985e742 --- /dev/null +++ b/8.6/stretch/Dockerfile @@ -0,0 +1,24 @@ +## Dockerfile for a haskell environment +FROM buildpack-deps:stretch + +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git && \ + echo 'deb http://downloads.haskell.org/debian stretch main' > /etc/apt/sources.list.d/ghc.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ + apt-get update && \ + apt-get install -y --no-install-recommends ghc-8.6.5 cabal-install-3.0 \ + ghc-8.6.5-prof libtinfo-dev && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ + tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ + /usr/local/bin/stack config set system-ghc --global true && \ + /usr/local/bin/stack config set install-ghc --global false && \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH + +## run ghci by default unless a command is specified +CMD ["ghci"] diff --git a/8.6/Dockerfile b/8.6/stretch/slim/Dockerfile similarity index 59% rename from 8.6/Dockerfile rename to 8.6/stretch/slim/Dockerfile index c53dcb6..3067c64 100644 --- a/8.6/Dockerfile +++ b/8.6/stretch/slim/Dockerfile @@ -9,19 +9,16 @@ RUN apt-get update && \ echo 'deb http://downloads.haskell.org/debian stretch main' > /etc/apt/sources.list.d/ghc.list && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ apt-get update && \ - apt-get install -y --no-install-recommends ghc-8.6.5 cabal-install-2.4 \ - zlib1g-dev libtinfo-dev libsqlite3-dev g++ netbase xz-utils make openssh-client && \ - curl -fSL https://github.com/commercialhaskell/stack/releases/download/v1.9.3/stack-1.9.3-linux-x86_64.tar.gz -o stack.tar.gz && \ - curl -fSL https://github.com/commercialhaskell/stack/releases/download/v1.9.3/stack-1.9.3-linux-x86_64.tar.gz.asc -o stack.tar.gz.asc && \ - export GNUPGHOME="$(mktemp -d)" && \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys C5705533DA4F78D8664B5DC0575159689BEFB442 && \ - gpg --batch --verify stack.tar.gz.asc stack.tar.gz && \ + apt-get install -y --no-install-recommends ghc-8.6.5 cabal-install-3.0 \ + zlib1g-dev libtinfo-dev libsqlite3-dev g++ netbase xz-utils make && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ /usr/local/bin/stack config set system-ghc --global true && \ /usr/local/bin/stack config set install-ghc --global false && \ - rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz.asc /stack.tar.gz + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz -ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/2.4/bin:/opt/ghc/8.6.5/bin:$PATH +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH ## run ghci by default unless a command is specified CMD ["ghci"] diff --git a/8.8/buster/Dockerfile b/8.8/buster/Dockerfile new file mode 100644 index 0000000..01cac46 --- /dev/null +++ b/8.8/buster/Dockerfile @@ -0,0 +1,24 @@ +## Dockerfile for a haskell environment +FROM buildpack-deps:buster + +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git && \ + echo 'deb http://downloads.haskell.org/debian buster main' > /etc/apt/sources.list.d/ghc.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ + apt-get update && \ + apt-get install -y --no-install-recommends ghc-8.8.1 cabal-install-3.0 \ + ghc-8.8.1-prof libtinfo-dev && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ + tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ + /usr/local/bin/stack config set system-ghc --global true && \ + /usr/local/bin/stack config set install-ghc --global false && \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH + +## run ghci by default unless a command is specified +CMD ["ghci"] diff --git a/8.8/buster/slim/Dockerfile b/8.8/buster/slim/Dockerfile new file mode 100644 index 0000000..d850679 --- /dev/null +++ b/8.8/buster/slim/Dockerfile @@ -0,0 +1,24 @@ +## Dockerfile for a haskell environment +FROM debian:buster + +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git && \ + echo 'deb http://downloads.haskell.org/debian buster main' > /etc/apt/sources.list.d/ghc.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ + apt-get update && \ + apt-get install -y --no-install-recommends ghc-8.8.1 cabal-install-3.0 \ + zlib1g-dev libtinfo-dev libsqlite3-dev g++ netbase xz-utils make && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ + tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ + /usr/local/bin/stack config set system-ghc --global true && \ + /usr/local/bin/stack config set install-ghc --global false && \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH + +## run ghci by default unless a command is specified +CMD ["ghci"] diff --git a/8.8/stretch/Dockerfile b/8.8/stretch/Dockerfile new file mode 100644 index 0000000..9f1ff8f --- /dev/null +++ b/8.8/stretch/Dockerfile @@ -0,0 +1,24 @@ +## Dockerfile for a haskell environment +FROM buildpack-deps:stretch + +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git && \ + echo 'deb http://downloads.haskell.org/debian stretch main' > /etc/apt/sources.list.d/ghc.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ + apt-get update && \ + apt-get install -y --no-install-recommends ghc-8.8.1 cabal-install-3.0 \ + ghc-8.8.1-prof libtinfo-dev && \ + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ + tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ + /usr/local/bin/stack config set system-ghc --global true && \ + /usr/local/bin/stack config set install-ghc --global false && \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH + +## run ghci by default unless a command is specified +CMD ["ghci"] diff --git a/8.8/Dockerfile b/8.8/stretch/slim/Dockerfile similarity index 64% rename from 8.8/Dockerfile rename to 8.8/stretch/slim/Dockerfile index e76e293..a50944b 100644 --- a/8.8/Dockerfile +++ b/8.8/stretch/slim/Dockerfile @@ -10,17 +10,13 @@ RUN apt-get update && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ apt-get update && \ apt-get install -y --no-install-recommends ghc-8.8.1 cabal-install-3.0 \ - zlib1g-dev libtinfo-dev libsqlite3-dev g++ netbase xz-utils make openssh-client && \ + zlib1g-dev libtinfo-dev libsqlite3-dev g++ netbase xz-utils make && \ curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz -o stack.tar.gz && \ - curl -fSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz.asc -o stack.tar.gz.asc && \ - export GNUPGHOME="$(mktemp -d)" && \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys C5705533DA4F78D8664B5DC0575159689BEFB442 && \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys 2C6A674E85EE3FB896AFC9B965101FF31C5C154D && \ - gpg --batch --trusted-key 0x575159689BEFB442 --verify stack.tar.gz.asc stack.tar.gz && \ + echo "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673 stack.tar.gz" | sha256sum -c - && \ tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ /usr/local/bin/stack config set system-ghc --global true && \ /usr/local/bin/stack config set install-ghc --global false && \ - rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz.asc /stack.tar.gz + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH diff --git a/Dockerfile.template b/Dockerfile.template new file mode 100644 index 0000000..8617fa4 --- /dev/null +++ b/Dockerfile.template @@ -0,0 +1,34 @@ +## Dockerfile for a haskell environment +{% if slim %} +FROM debian:{{distribution}} +{% else %} +FROM buildpack-deps:{{distribution}} +{% endif %} + +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git && \ + echo 'deb http://downloads.haskell.org/debian {{distribution}} main' > /etc/apt/sources.list.d/ghc.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 && \ + apt-get update && \ + apt-get install -y --no-install-recommends ghc-{{ghcVersion}} cabal-install-3.0 \ +{% if slim %} +{# See https://github.c om/docker-library/buildpack-deps/blob/master/buster/Dockerfile #} +{# And https://github.com/docker-library/buildpack-deps/blob/master/buster/scm/Dockerfile #} + zlib1g-dev libtinfo-dev libsqlite3-dev g++ netbase xz-utils make && \ +{% else %} + ghc-{{ghcVersion}}-prof libtinfo-dev && \ +{% endif %} + curl -fSL https://github.com/commercialhaskell/stack/releases/download/v{{stackVersion}}/stack-{{stackVersion}}-linux-x86_64.tar.gz -o stack.tar.gz && \ + echo "{{stackSha256}} stack.tar.gz" | sha256sum -c - && \ + tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \ + /usr/local/bin/stack config set system-ghc --global true && \ + /usr/local/bin/stack config set install-ghc --global false && \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/3.0/bin:/opt/ghc/8.8.1/bin:$PATH + +## run ghci by default unless a command is specified +CMD ["ghci"] diff --git a/generate.hs b/generate.hs new file mode 100644 index 0000000..81408e7 --- /dev/null +++ b/generate.hs @@ -0,0 +1,90 @@ +{-# LANGUAGE DeriveGeneric #-} +-- | Script to generate dockerfiles. Obviously using Haskell. +-- +-- TBW usage +module Main (main) where + +import Control.Monad (forM_) +import Data.Char (toLower) +import Data.List (intercalate) +import GHC.Generics (Generic) +import System.FilePath ((), takeDirectory) +import System.Directory (createDirectoryIfMissing) + +import Zinza + +params :: [(FilePath, Params)] +params = + [ mk dist ver slim + | dist <- [Stretch ..] + , slim <- [True, False] + , ver <- [ Version [8,8,1] + , Version [8,6,5] + , Version [8,4,4] + ] + ] + where + mk :: Distribution -> Version -> Bool -> (FilePath, Params) + mk dist gv slim = (,) fp Params + { pDistribution = dist + , pGhcVersion = gv + , pSlim = slim + -- See stack-shasum.sh + , pStackVersion = Version [2,1,3] + , pStackSha256 = "c724b207831fe5f06b087bac7e01d33e61a1c9cad6be0468f9c117d383ec5673" + } + where + dir = dispVersion (majorVersion gv) dispDistribution dist + + fp | slim = dir "slim" "Dockerfile" + | otherwise = dir "Dockerfile" + +main :: IO () +main = do + template <- parseAndCompileTemplateIO "Dockerfile.template" + forM_ params $ \(fp, p) -> do + contents <- template p + createDirectoryIfMissing True (takeDirectory fp) + writeFile fp contents + +------------------------------------------------------------------------------- +-- Data types +------------------------------------------------------------------------------- + +newtype Version = Version [Int] + deriving (Show) + +dispVersion :: Version -> String +dispVersion (Version vs) = intercalate "." (map show vs) + +majorVersion :: Version -> Version +majorVersion v@(Version []) = v +majorVersion v@(Version [_]) = v +majorVersion v@(Version (x:y:_)) = Version [x,y] + +instance Zinza Version where + toType _ = TyString Nothing + toValue = VString . dispVersion + +data Distribution = Stretch | Buster + deriving (Show, Enum, Bounded) + +dispDistribution :: Distribution -> String +dispDistribution = map toLower . show + +instance Zinza Distribution where + toType _ = TyString Nothing + toValue = VString . dispDistribution + +data Params = Params + { pDistribution :: Distribution + , pGhcVersion :: Version + , pSlim :: Bool + , pStackVersion :: Version + , pStackSha256 :: String + } + deriving (Show, Generic) + +instance Zinza Params where + toType = genericToTypeSFP + toValue = genericToValueSFP diff --git a/stack-shasum.sh b/stack-shasum.sh new file mode 100644 index 0000000..08f3077 --- /dev/null +++ b/stack-shasum.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Get stack, verify using GPG, calculate tarball sha256sum + +# Get keys +# +# gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys C5705533DA4F78D8664B5DC0575159689BEFB442 +# gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys 2C6A674E85EE3FB896AFC9B965101FF31C5C154D +# + +STACKVER=2.1.3 + +curl -fSL https://github.com/commercialhaskell/stack/releases/download/v${STACKVER}/stack-${STACKVER}-linux-x86_64.tar.gz -o stack.tar.gz && \ +curl -fSL https://github.com/commercialhaskell/stack/releases/download/v${STACKVER}/stack-${STACKVER}-linux-x86_64.tar.gz.asc -o stack.tar.gz.asc && \ + +gpg --batch --trusted-key 0x575159689BEFB442 --verify stack.tar.gz.asc stack.tar.gz + +sha256sum stack.tar.gz +