cellxgene_VIP icon indicating copy to clipboard operation
cellxgene_VIP copied to clipboard

Build to custom docker container

Open eusebiu opened this issue 2 years ago • 1 comments

Hi, I am trying to build a docker container based on the steps from VIP - https://github.com/interactivereport/cellxgene_VIP:

FROM python:3.8

COPY ./cellxgene_VIP /cellxgene_VIP

RUN apt update
RUN apt install jq nodejs npm dirmngr gnupg apt-transport-https ca-certificates software-properties-common r-base build-essential -y

RUN cd cellxgene_VIP && \
    chmod +x config.sh && \
    ./config.sh && \
    cd ..

config.sh is: https://github.com/interactivereport/cellxgene_VIP/blob/master/config.sh and when I run docker built -t cellxgene . I get this error:

...
Step 7/11 : RUN cd cellxgene_VIP &&     chmod +x config.sh &&     ./config.sh &&     cd ..
 ---> Running in c6c88429b767
Cloning into 'cellxgene'...
Note: switching to 'bdfd9fe0a5462a0c139675fe10356765d2bbd95b'.
...
cd client && make ci build
make[1]: Entering directory '/cellxgene_VIP/cellxgene/client'
npm ci
npm ERR! code 1
npm ERR! path /cellxgene_VIP/cellxgene/client/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 3.8.13 found at "/usr/local/bin/python3"
npm ERR! gyp info spawn /usr/local/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/share/nodejs/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/cellxgene_VIP/cellxgene/client/node_modules/sharp/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/share/nodejs/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/include/nodejs/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/usr/include/nodejs',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/share/nodejs/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/usr/include/nodejs/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/cellxgene_VIP/cellxgene/client/node_modules/sharp',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR!   File "/usr/share/nodejs/node-gyp/gyp/gyp_main.py", line 33, in <module>
npm ERR!     sys.exit(load_entry_point('gyp==0.1', 'console_scripts', 'gyp')())
npm ERR!   File "/usr/share/nodejs/node-gyp/gyp/gyp_main.py", line 22, in importlib_load_entry_point
npm ERR!     for entry_point in distribution(dist_name).entry_points
npm ERR!   File "/usr/local/lib/python3.8/importlib/metadata.py", line 503, in distribution
npm ERR!     return Distribution.from_name(distribution_name)
npm ERR!   File "/usr/local/lib/python3.8/importlib/metadata.py", line 177, in from_name
npm ERR!     raise PackageNotFoundError(name)
npm ERR! importlib.metadata.PackageNotFoundError: gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/nodejs/node-gyp/lib/configure.js:355:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
npm ERR! gyp ERR! System Linux 5.13.0-41-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/share/nodejs/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /cellxgene_VIP/cellxgene/client/node_modules/sharp
npm ERR! gyp ERR! node -v v12.22.12
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-06-28T11_50_02_388Z-debug.log
make[1]: *** [Makefile:16: ci] Error 1
make[1]: Leaving directory '/cellxgene_VIP/cellxgene/client'
make: *** [Makefile:27: build-client] Error 2
The command '/bin/sh -c cd cellxgene_VIP &&     chmod +x config.sh &&     ./config.sh &&     cd ..' returned a non-zero code: 2

Any ideas how to fix it?

eusebiu avatar Jun 28 '22 12:06 eusebiu

Hi @eusebiu ! I would recommend you try using a base image that provides conda, and then create a conda environment with something like

    conda env create -n VIP -f VIP_conda_R.yml

The conda environment installs many dependencies including a specific version of nodejs, see: https://github.com/interactivereport/cellxgene_VIP/blob/master/VIP_conda_R.yml#L79

alokito avatar Oct 25 '22 19:10 alokito

@eusebiu You might want to give it a try to my Dockerfile I wrote for this plugin. I guess it will work with the latest commit. Instead of conda, you used mamba to solve the package dependencies faster :)

https://github.com/michaeleekk/cellxgene_VIP/blob/cellxgene-1.1.1/Dockerfile

michaeleekk avatar Oct 28 '22 10:10 michaeleekk