petermr / xmlopensci

XML Tools and resources for Open Science
Apache License 2.0
1 stars 2 forks source link

Build docker image. #1

Open ambarishK opened 5 years ago

ambarishK commented 5 years ago

Build docker image.


- ami3dockerfile

FROM rtfpessoa/ubuntu-jdk8

ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update RUN apt-get install tzdata RUN apt-get install -y \ maven \ python3.7 \ python3-pip \ tesseract-ocr \ imagemagick \ libopencv-dev

ADD ami3 /usr/src/ami3 ADD forestplots /usr/src/forestplots ADD forestplots.py /usr/src/forestplots.py ADD requirements.txt /usr/src/requirements.txt

WORKDIR /usr/src/cephis RUN mvn install -Dmaven.test.skip=true

WORKDIR /usr/src/ami3 RUN mvn install -Dmaven.test.skip=true

WORKDIR /usr/src RUN python3.7 -m pip install -r requirements.txt

ENV PATH="/usr/src/ami3/target/appassembler/bin:/usr/src:${PATH}" ENV FORESTPLOT_USE_DOCKER="no"

petermr commented 5 years ago

We can cut down the size No need for cephis No need forest plots No need for tesseract-ocr \ imagemagick \ libopencv-dev

petermr commented 5 years ago

My suggested script would be:

FROM rtfpessoa/ubuntu-jdk8

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install tzdata
RUN apt-get install -y \
    maven \
    python3.7 \
    python3-pip 

ADD ami3 /usr/src/ami3
ADD requirements.txt /usr/src/requirements.txt

WORKDIR /usr/src/ami3
RUN mvn install -Dmaven.test.skip=true

WORKDIR /usr/src
RUN python3.7 -m pip install -r requirements.txt

ENV PATH="/usr/src/ami3/target/appassembler/bin:/usr/src:${PATH}"
ENV FORESTPLOT_USE_DOCKER="no"
petermr commented 5 years ago

wil be available in 15 minutes.

ambarishK commented 5 years ago

Let me try for this dockerfile.

Re-building the image for ami3.

ambarishK commented 5 years ago

Build for ami3 docker image is complete but there is no REPOSITORY name and TAG for the image.

Description of image

  ---> 9dcc305c0054
Successfully built 9dcc305c0054
[root@localhost CEVOpen]# docker image ls
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
<none>                  <none>              9dcc305c0054        44 seconds ago      1.57GB'
[root@localhost CEVOpen]# docker tag 9dcc305c0054 ami3docker:latest
[root@localhost CEVOpen]# docker image ls
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
ami3docker              latest              9dcc305c0054        14 minutes ago      1.57GB
petermr commented 5 years ago

Please indicate

Thanks

petermr commented 5 years ago

Ambarish, Is it running for you?

ambarishK commented 5 years ago

Yes sir, build and test for ami3 is successful.


- Test run of ami3 tools - `ami-pdf`

root@90250c967ca1:/usr/src# ami-pdf Usage: ami-pdf [OPTIONS] Description

Convert PDFs to SVG-Text, SVG-graphics and Images. Does not process images, graphics or text.often followed by ami-image and ami-xml? Options



Test run for ami3 tools are successful.
ambarishK commented 5 years ago

Now going to build getpapers.

petermr commented 5 years ago

Looks good!

ambarishK commented 5 years ago

Building docker image for getpapers.

Docker file for getpapers ( including steps for installing nvm and node ).
FROM rtfpessoa/ubuntu-jdk8

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install tzdata
RUN apt-get install -y 

RUN wget https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh
RUN sh install.sh

RUN nvm install 7
RUN nvm use 7
RUN nvm alias default 7

WORKDIR /usr/src
RUN npm install --global getpapers

Note : It needs to restart the terminal to configure nvm, so docker command for installing node breaks in between.

nvm and node requires prior installation of running getpapers docker image.

re-writing dockerfile for getpapers.

Prior installed with nvm and node.

  FROM rtfpessoa/ubuntu-jdk8

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install tzdata
RUN apt-get install -y 

WORKDIR /usr/src
RUN npm install --global getpapers

Throws errors.

The command '/bin/sh -c apt-get install git-core curl build-essential openssl libssl-dev  && git clone https://github.com/nodejs/node.git  && cd node  && ./configure  && make  && sudo make install' returned a non-zero code: 1
petermr commented 5 years ago

Thanks. Can we run with external input files, e.g.

cd CEVOpen
ami-search -p oil186 --dictionary mydictionary/oilplant.xml

On Mon, Sep 16, 2019 at 1:39 PM Ambarish Kumar notifications@github.com wrote:

Building docker image for getpapers. Docker file for getpapers ( including steps for installing nvm and node ).

FROM rtfpessoa/ubuntu-jdk8

ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update RUN apt-get install tzdata RUN apt-get install -y

RUN wget https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh RUN sh install.sh

RUN nvm install 7 RUN nvm use 7 RUN nvm alias default 7

WORKDIR /usr/src RUN npm install --global getpapers

Note : It needs to restart the terminal to configure nvm, so docker command for installing node breaks in between.

nvm and node requires prior installation of running getpapers docker image. re-writing dockerfile for getpapers.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/petermr/xmlopensci/issues/1?email_source=notifications&email_token=AAFTCS46NFWGGWGOKFROHUTQJ547LA5CNFSM4IW6MF3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6Y76PA#issuecomment-531758908, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFTCS35XTWLKCXTK7HF2STQJ547LANCNFSM4IW6MF3A .

-- Peter Murray-Rust Founder ContentMine.org and Reader Emeritus in Molecular Informatics Dept. Of Chemistry, University of Cambridge, CB2 1EW, UK

ambarishK commented 5 years ago

For that we will have to mount the external volume - volume outside of container.

ambarishK commented 5 years ago

Sir, building getpaper is generating error. I tried for two-three ways to build dockerfile for getpapers.

petermr commented 5 years ago

On Mon, Sep 16, 2019 at 3:34 PM Ambarish Kumar notifications@github.com wrote:

Sir, building getpaper is generating error.

NO This statement means nothing. Also spell it correctly Be more specific, something like: "cannot install getpapers; creates the followiing error trace ... (list)" OR "getpapers does not retrieve any papers:" ... output

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/petermr/xmlopensci/issues/1?email_source=notifications&email_token=AAFTCS3MGPPU3AMZU7TCSPTQJ6KOVA5CNFSM4IW6MF3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6ZLIMA#issuecomment-531805232, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFTCS6NU7SB4FRUU7TASFLQJ6KOVANCNFSM4IW6MF3A .

-- Peter Murray-Rust Founder ContentMine.org and Reader Emeritus in Molecular Informatics Dept. Of Chemistry, University of Cambridge, CB2 1EW, UK

ambarishK commented 5 years ago

Sir, while building dockerfile for getpapers error is at installation step of node. After installing nvm, it needs to restart the terminal to configure installation of nvm and go for node installation. So, it can not install node. Execution of docker build fails at this very step.

ambarishK commented 5 years ago

External volume mount to docker container. CProjectAndDictionaries - directory containing /oil186/ and /mydictionaries/ - this is the external volume which is being mounted.

workDir - This is the volume within container to which external directory is mounted.

[root@localhost CEVOpen]# docker run -v /home/cbl/CEVOpen/CProjectAndDictionaries:/usr/src/workDir -i -t ami3docker:latest 

root@48ad1b7e57ac:/usr/src# ls
ami3  requirements.txt  workDir

root@48ad1b7e57ac:/usr/src# cd workDir/

root@48ad1b7e57ac:/usr/src/workDir# ls
mydictionaries  oil186

root@48ad1b7e57ac:/usr/src/workDir# cd ..

root@48ad1b7e57ac:/usr/src# ami-search -p workDir/oil186 --dictionary workDir/mydictionary/oilplant.xml

Run of ami-tool using ami3 docker image is generating error. Details are as following.

root@48ad1b7e57ac:/usr/src# ami-search -p workDir/oil186 --dictionary workDir/mydictionary/oilplant.xml

Generic values (AMISearchTool)
================================
-v to see generic values
oldstyle            true

Specific values (AMISearchTool)
================================
oldstyle             true
strip numbers        false
wordCountRange       (20,1000000)
wordLengthRange      (1,20)

dictionaryList       [workDir/mydictionary/oilplant.xml]
dictionaryTop        null
dictionarySuffix     [xml]

Exception in thread "main" java.lang.RuntimeException: Cannot read/process args file /org/contentmine/cproject/args/args.xml
    at org.contentmine.cproject.args.DefaultArgProcessor.readArgumentOptions(DefaultArgProcessor.java:295)
    at org.contentmine.cproject.args.DefaultArgProcessor.<init>(DefaultArgProcessor.java:234)
    at org.contentmine.cproject.CProjectArgProcessor.<init>(CProjectArgProcessor.java:92)
    at org.contentmine.norma.NormaArgProcessor.<init>(NormaArgProcessor.java:96)
    at org.contentmine.ami.plugins.AMIArgProcessor.<init>(AMIArgProcessor.java:95)
    at org.contentmine.ami.plugins.AbstractSearchArgProcessor.<init>(AbstractSearchArgProcessor.java:41)
    at org.contentmine.ami.plugins.search.SearchArgProcessor.<init>(SearchArgProcessor.java:30)
    at org.contentmine.ami.tools.AMISearchTool.getOrCreateSearchProcessor(AMISearchTool.java:316)
    at org.contentmine.ami.tools.AbstractAMISearchTool.runSpecifics(AbstractAMISearchTool.java:159)
    at org.contentmine.ami.tools.AbstractAMITool.runCommands(AbstractAMITool.java:333)
    at org.contentmine.ami.tools.AbstractAMITool.runCommands(AbstractAMITool.java:315)
    at org.contentmine.ami.tools.AMISearchTool.main(AMISearchTool.java:150)
Caused by: java.lang.RuntimeException: Cannot find input resource stream: class(class org.contentmine.cproject.CProjectArgProcessor); /org/contentmine/cproject/args/args.xml
    at org.contentmine.cproject.args.DefaultArgProcessor.readArgumentOptions(DefaultArgProcessor.java:287)
    ... 11 more

ami-search is in error state. Even running ami-search outside docker container is generating error.

[root@localhost bin]# export PATH=$PATH:/home/cbl/CEVOpen/ami3/target/appassembler/bin

[root@localhost CEVOpen]# ami-search

Usage: ami-search [OPTIONS]
Description
===========
searches text (and maybe SVG). Has specialist subcommands
Options
=======

Generic values (AMISearchTool)
================================
-v to see generic values
oldstyle            true

Specific values (AMISearchTool)
================================
oldstyle             true
strip numbers        false
wordCountRange       (20,1000000)
wordLengthRange      (1,20)

dictionaryList       null
dictionaryTop        null
dictionarySuffix     [xml]

Exception in thread "main" java.lang.RuntimeException: Cannot read/process args file /org/contentmine/cproject/args/args.xml
    at org.contentmine.cproject.args.DefaultArgProcessor.readArgumentOptions(DefaultArgProcessor.java:295)
    at org.contentmine.cproject.args.DefaultArgProcessor.<init>(DefaultArgProcessor.java:234)
    at org.contentmine.cproject.CProjectArgProcessor.<init>(CProjectArgProcessor.java:92)
    at org.contentmine.norma.NormaArgProcessor.<init>(NormaArgProcessor.java:96)
    at org.contentmine.ami.plugins.AMIArgProcessor.<init>(AMIArgProcessor.java:95)
    at org.contentmine.ami.plugins.AbstractSearchArgProcessor.<init>(AbstractSearchArgProcessor.java:41)
    at org.contentmine.ami.plugins.search.SearchArgProcessor.<init>(SearchArgProcessor.java:30)
    at org.contentmine.ami.tools.AMISearchTool.getOrCreateSearchProcessor(AMISearchTool.java:316)
    at org.contentmine.ami.tools.AbstractAMISearchTool.runSpecifics(AbstractAMISearchTool.java:159)
    at org.contentmine.ami.tools.AbstractAMITool.runCommands(AbstractAMITool.java:333)
    at org.contentmine.ami.tools.AbstractAMITool.runCommands(AbstractAMITool.java:315)
    at org.contentmine.ami.tools.AMISearchTool.main(AMISearchTool.java:150)
Caused by: java.lang.RuntimeException: Cannot find input resource stream: class(class org.contentmine.cproject.CProjectArgProcessor); /org/contentmine/cproject/args/args.xml
    at org.contentmine.cproject.args.DefaultArgProcessor.readArgumentOptions(DefaultArgProcessor.java:287)
    ... 11 more