Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
155
Issues
155
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
haskell-gargantext
Commits
99c59024
Verified
Commit
99c59024
authored
Mar 06, 2025
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[nix] add corenlp.nix, implement in Dockerfile
parent
181e477d
Pipeline
#7412
failed with stages
in 82 minutes and 18 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
33 deletions
+72
-33
Dockerfile
devops/docker/Dockerfile
+18
-22
corenlp.nix
nix/corenlp.nix
+41
-0
pkgs.nix
nix/pkgs.nix
+4
-0
Main.hs
test/drivers/hspec/Main.hs
+9
-11
No files found.
devops/docker/Dockerfile
View file @
99c59024
...
...
@@ -18,32 +18,27 @@ ENV PATH=/root/.local/bin:$PATH
RUN
apt-get update
&&
\
apt-get
install
--no-install-recommends
-y
\
apt-transport-https
\
autoconf
\
automake
\
build-essential
\
#
autoconf
\
#
automake
\
#
build-essential
\
ca-certificates
\
curl
\
#gcc
\
git
\
gnupg2
\
libffi-dev
\
libffi8
\
libgmp-dev
\
libgmp10
\
libncurses-dev
\
libncurses6
\
libnuma-dev
\
libtinfo6
\
#
libffi-dev
\
#
libffi8
\
#
libgmp-dev
\
#
libgmp10
\
#
libncurses-dev
\
#
libncurses6
\
#
libnuma-dev
\
#
libtinfo6
\
locales
\
lsb-release
\
#
lsb-release
\
software-properties-common
\
#strace
\
sudo
\
#wget
\
#vim
\
xz-utils
\
zlib1g-dev
\
#openjdk-21-jdk
\
unzip
&&
\
apt-get clean
&&
rm
-rf
/var/lib/apt/lists/
*
&&
\
mkdir
-m
0755 /nix
&&
groupadd
-r
nixbld
&&
chown
root /nix
&&
\
...
...
@@ -55,23 +50,24 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY
./shell.nix /builds/gargantext/shell.nix
COPY
./nix/pkgs.nix /builds/gargantext/nix/pkgs.nix
COPY
./nix/corenlp.nix /builds/gargantext/nix/corenlp.nix
COPY
./nix/pinned-25.05.nix /builds/gargantext/nix/pinned-25.05.nix
COPY
./devops/coreNLP/build.sh /root/devops/coreNLP/build.sh
COPY
./devops/coreNLP/startServer.sh /root/devops/coreNLP/startServer.sh
#
COPY ./devops/coreNLP/startServer.sh /root/devops/coreNLP/startServer.sh
COPY
./bin/setup-ci-environment /builds/gargantext/bin/setup-ci-environment
COPY
./bin/install-cabal2stack /builds/gargantext/bin/install-cabal2stack
#RUN cd /root/devops/coreNLP; ./build.sh && \
RUN
set
-o
pipefail
&&
\
locale-gen en_US.UTF-8
&&
\
bash <
(
curl
-L
https://releases.nixos.org/nix/nix-2.26.2/install
)
--no-daemon
&&
\
locale-gen en_US.UTF-8
&&
chown
root
-R
/nix
&&
\
chown
root
-R
/nix
&&
\
.
"
$HOME
/.nix-profile/etc/profile.d/nix.sh"
&&
\
mkdir
-p
"/builds/gargantext/"
&&
chmod
777
-R
"/builds/gargantext"
&&
\
echo
"source
$HOME
/.nix-profile/etc/profile.d/nix.sh"
>>
"
$HOME
/.bashrc"
&&
\
echo
`
which nix-env
`
&&
\
.
$HOME
/.bashrc
&&
nix-env
--version
&&
\
cd
/builds/gargantext
&&
nix-shell
--run
"./bin/install-cabal2stack"
&&
\
cd
/root/devops/coreNLP
&&
nix-shell
-p
jre
--run
"./build.sh"
cd
/builds/gargantext
&&
nix-shell
--run
"./bin/install-cabal2stack"
#
cd /root/devops/coreNLP && nix-shell -p jre --run "./build.sh"
WORKDIR
"/builds/gargantext/"
nix/corenlp.nix
0 → 100644
View file @
99c59024
# https://nixos.wiki/wiki/Java
{
fetchzip
,
stdenv
,
writeShellScript
,
jre
,
version
?
"4.5.8"
,
hash
?
"sha256-HZHNyw+LrxAN4OLueAhyxRG2onPWNMm5MwJDLLzsE2M="
}:
let
file_name
=
"stanford-corenlp-
${
version
}
.zip"
;
url
=
"http://nlp.stanford.edu/software/
${
file_name
}
"
;
zip_file
=
fetchzip
{
inherit
url
hash
;
};
start_server
=
writeShellScript
"startCoreNLPServer.sh"
''
PORT=9000
while getopts ':p:h' opt; do
case $opt in
(p) PORT=$OPTARG;;
(h) echo "$(basename $0) [-p 9000]"
exit 0
;;
esac
done
shift "$((OPTIND - 1))"
${
jre
}
/bin/java -mx4g -cp "
${
zip_file
}
/*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port $PORT -timeout 15000
''
;
in
stdenv
.
mkDerivation
rec
{
name
=
"corenlp"
;
inherit
version
;
phases
=
"installPhase"
;
installPhase
=
''
mkdir -p $out/bin
cp
${
start_server
}
$out/bin/startCoreNLPServer.sh
''
;
}
nix/pkgs.nix
View file @
99c59024
...
...
@@ -88,6 +88,9 @@ rec {
''
;
});
corenlp
=
pkgs
.
callPackage
./corenlp.nix
{
};
hsBuildInputs
=
[
ghc966
cabal_install
...
...
@@ -97,6 +100,7 @@ rec {
];
nonhsBuildInputs
=
with
pkgs
;
[
bzip2
corenlp
czmq
docker-compose
git
...
...
test/drivers/hspec/Main.hs
View file @
99c59024
...
...
@@ -19,18 +19,16 @@ startCoreNLPServer :: IO ProcessHandle
startCoreNLPServer
=
do
putText
"calling start core nlp"
devNull
<-
openFile
"/dev/null"
WriteMode
let
p
=
proc
"./startServer.sh"
[]
(
_
,
_
,
_
,
hdl
)
<-
(
createProcess
$
p
{
cwd
=
Just
"devops/coreNLP/stanford-corenlp-current"
let
p
=
proc
"startCoreNLPServer.sh"
[]
(
_
,
_
,
_
,
hdl
)
<-
(
createProcess
$
p
{
cwd
=
Nothing
,
delegate_ctlc
=
True
,
create_group
=
True
,
std_out
=
UseHandle
devNull
,
std_err
=
UseHandle
devNull
})
`
catch
`
\
e
->
case
e
of
_
|
True
<-
"does not exist"
`
isInfixOf
`
(
T
.
pack
.
show
@
SomeException
$
e
)
->
fail
$
"Cannot execute the 'startServer.sh' script. If this is the "
<>
"first time you are running the tests, you have to run "
<>
"cd devops/coreNLP && ./build.sh first. You have to run it only once, "
<>
"and then you are good to go for the time being."
->
fail
$
"Cannot execute the 'startCoreNLPServer.sh' script. Make sure you are in a nix environment."
|
otherwise
->
throwIO
e
pure
hdl
...
...
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