Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
296c8e47
Commit
296c8e47
authored
Aug 17, 2021
by
Brandon Chinn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Dockerfile
parent
7465c5d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
37 deletions
+78
-37
Dockerfile
Dockerfile
+77
-37
stack.yaml
stack.yaml
+1
-0
No files found.
Dockerfile
View file @
296c8e47
FROM
ubuntu:18.04
# should match the GHC version of the stack.yaml resolver
FROM
haskell:8.10.4 AS ihaskell_base
ARG
STACK_VERSION=2.7.3
# Install Ubuntu packages needed for IHaskell runtime
ARG
RESOLVER=lts-17.4
RUN
apt-get update
&&
\
apt-get
install
-y
\
libblas3
\
libcairo2
\
liblapack3
\
libmagic1
\
libpango-1.0-0
\
libzmq5
\
&&
\
rm
-rf
/var/lib/apt/lists/
*
FROM
ihaskell_base AS builder
# Install all necessary Ubuntu packages
# Install Ubuntu packages needed for IHaskell build
RUN
apt-get update
&&
apt-get
install
-y
python3-pip libgmp-dev libmagic-dev libtinfo-dev libzmq3-dev libcairo2-dev libpango1.0-dev libblas-dev liblapack-dev gcc g++ wget
&&
\
RUN
apt-get update
&&
\
apt-get
install
-y
\
libblas-dev
\
libcairo2-dev
\
liblapack-dev
\
libmagic-dev
\
libpango1.0-dev
\
libzmq3-dev
\
&&
\
rm
-rf
/var/lib/apt/lists/
*
rm
-rf
/var/lib/apt/lists/
*
WORKDIR
/build
# Build snapshot
COPY
stack.yaml stack.yaml
COPY
ihaskell.cabal ihaskell.cabal
COPY
ipython-kernel ipython-kernel
COPY
ghc-parser ghc-parser
COPY
ihaskell-display ihaskell-display
RUN
stack setup
RUN
stack build
--only-snapshot
# Build IHaskell itself.
# Don't just `COPY .` so that changes in e.g. README.md don't trigger rebuild.
COPY
src src
COPY
html html
COPY
main main
COPY
LICENSE LICENSE
RUN
stack
install
--local-bin-path
./bin/
# Save resolver used to build IHaskell
RUN
sed
-n
's/resolver: \(.*\)/\1/p'
stack.yaml |
tee
resolver.txt
# Save third-party data files
RUN
mkdir
/data
&&
\
snapshot_install_root
=
$(
stack path
--snapshot-install-root
)
&&
\
cp
$(
find
${
snapshot_install_root
}
-name
hlint.yaml
)
/data
FROM
ihaskell_base AS ihaskell
# Install Jupyter notebook
# Install Jupyter notebook
RUN
apt-get update
&&
\
apt-get
install
-y
python3-pip
&&
\
rm
-rf
/var/lib/apt/lists/
*
RUN
pip3
install
-U
jupyter
RUN
pip3
install
-U
jupyter
ENV
LANG C.UTF-8
# Create runtime user
ENV
LC_ALL C.UTF-8
ENV
NB_USER jovyan
ENV
NB_USER jovyan
ENV
NB_UID 1000
ENV
NB_UID 1000
ENV
HOME /home/${NB_USER}
RUN
adduser
--disabled-password
\
RUN
adduser
--disabled-password
\
--gecos
"Default user"
\
--gecos
"Default user"
\
--uid
${
NB_UID
}
\
--uid
${
NB_UID
}
\
${
NB_USER
}
${
NB_USER
}
RUN
wget
-qO-
https://github.com/commercialhaskell/stack/releases/download/v
$STACK_VERSION
/stack-
$STACK_VERSION
-linux-x86_64
.tar.gz |
tar
xz
--wildcards
--strip-components
=
1
-C
/usr/bin
'*/stack'
# Create directory for storing ihaskell files
ENV
IHASKELL_DATA_DIR /usr/local/lib/ihaskell
RUN
mkdir
-p
${
IHASKELL_DATA_DIR
}
&&
chown
${
NB_UID
}
${
IHASKELL_DATA_DIR
}
# Set up a working directory for IHaskell
# Set up + set hlint data directory
RUN
install
-d
-o
${
NB_UID
}
-g
${
NB_UID
}
${
HOME
}
${
HOME
}
/ihaskell
ENV
HLINT_DATA_DIR /usr/local/lib/hlint
WORKDIR
${HOME}/ihaskell
COPY
--from=builder --chown=${NB_UID} /data/hlint.yaml ${HLINT_DATA_DIR}/
ENV
hlint_datadir ${HLINT_DATA_DIR}
# Set current user + directory
USER
${NB_UID}
USER
${NB_UID}
ENV
HOME /home/${NB_USER}
WORKDIR
${HOME}
# Install dependencies for IHaskell
# Set up global project
COPY
--chown=${NB_UID}:${NB_UID} stack.yaml stack.yaml
COPY
--from=builder --chown=${NB_UID} /build/resolver.txt /tmp/
COPY
--chown=${NB_UID}:${NB_UID} ihaskell.cabal ihaskell.cabal
RUN
stack setup
--resolver
=
$(
cat
/tmp/resolver.txt
)
--system-ghc
COPY
--chown=${NB_UID}:${NB_UID} ipython-kernel ipython-kernel
COPY
--chown=${NB_UID}:${NB_UID} ghc-parser ghc-parser
COPY
--chown=${NB_UID}:${NB_UID} ihaskell-display ihaskell-display
RUN
stack setup
RUN
stack build
--only-snapshot
# Install IHaskell itself. Don't just COPY . so that
# changes in e.g. README.md don't trigger rebuild.
COPY
--chown=${NB_UID}:${NB_UID} src ${HOME}/ihaskell/src
COPY
--chown=${NB_UID}:${NB_UID} html ${HOME}/ihaskell/html
COPY
--chown=${NB_UID}:${NB_UID} main ${HOME}/ihaskell/main
COPY
--chown=${NB_UID}:${NB_UID} LICENSE ${HOME}/ihaskell/LICENSE
RUN
stack build
&&
stack
install
RUN
mkdir
-p
${
HOME
}
/.stack/global-project
&&
\
echo
"packages: []
\n
resolver:
${
RESOLVER
}
\n
"
>
${
HOME
}
/.stack/global-project/stack.yaml
# Run the notebook
# Install + setup IHaskell
ENV
PATH $(stack path --local-install-root)/bin:$(stack path --snapshot-install-root)/bin:$(stack path --compiler-bin):/home/${NB_USER}/.local/bin:${PATH}
COPY
--from=builder --chown=${NB_UID} /build/bin/ihaskell /usr/local/bin/
RUN
ihaskell
install
--stack
COPY
--from=builder --chown=${NB_UID} /build/html ${IHASKELL_DATA_DIR}/html
WORKDIR
${HOME}
RUN
export
ihaskell_datadir
=
${
IHASKELL_DATA_DIR
}
&&
\
ihaskell
install
--stack
RUN
jupyter notebook
--generate-config
RUN
jupyter notebook
--generate-config
CMD
["jupyter", "notebook", "--ip", "0.0.0.0"]
CMD
["jupyter", "notebook", "--ip", "0.0.0.0"]
stack.yaml
View file @
296c8e47
# the GHC version of this resolver needs to match the GHC version in Dockerfile
resolver
:
lts-18.5
resolver
:
lts-18.5
allow-newer
:
true
allow-newer
:
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment