From 13a8d6b335a940a378b9f3c93a16444389a42d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Pi=C3=B1eyro?= Date: Wed, 20 Feb 2019 22:44:25 -0300 Subject: [PATCH 1/2] Added Dockerfile definition --- Dockerfile | 49 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 2 ++ 2 files changed, 51 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..4158addc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,49 @@ +# +# NOTE: Tried with Haskell 8.2 and 8.0 and ended up with some build errors +# +FROM haskell:8.4 + +RUN mkdir /grenade +COPY . /grenade + +# +# Install system dependencies +# +RUN apt-get update && apt-get install -y \ + build-essential \ + gfortran \ + libatlas-base-dev \ + libgsl0-dev \ + liblapack-dev \ + python \ + wget + +# +# Install Open Blas (with Lapack included) +# This is a depencency for building hmatrix package +# +ENV OPEN_BLAS_VER=0.2.20 +RUN wget http://github.com/xianyi/OpenBLAS/archive/v$OPEN_BLAS_VER.tar.gz +RUN tar -xzvf v$OPEN_BLAS_VER.tar.gz + +WORKDIR /OpenBLAS-$OPEN_BLAS_VER +RUN ls -la +RUN make FC=gfortran +RUN make PREFIX=/usr/local install + +# +# Build and setup grenade +# +WORKDIR /grenade + +RUN stack init +RUN stack setup --install-ghc +RUN stack build + +# Optional GHCI prompt configuration +RUN echo ':set prompt "\ESC[34mλ> \ESC[m"' > ~/.ghci + +# +# Run GHC repl +# +CMD [ "stack", "ghci" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..b638e708 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,2 @@ +grenade: + build: . From 8a90770054e239bf43e4d65354bc93f57c632384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Pi=C3=B1eyro?= Date: Sun, 24 Feb 2019 18:44:54 -0300 Subject: [PATCH 2/2] Updated default command to run specified main on environment variable --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4158addc..c1f01684 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,12 @@ RUN stack build # Optional GHCI prompt configuration RUN echo ':set prompt "\ESC[34mλ> \ESC[m"' > ~/.ghci +# +# Choose default main object to run GHCI +# +ENV GRENADE_MAIN=mnist + # # Run GHC repl # -CMD [ "stack", "ghci" ] \ No newline at end of file +CMD stack ghci --main-is grenade-examples:exe:$GRENADE_MAIN \ No newline at end of file