ailispaw / docker-root

Deprecated: Lightweight Linux for Docker made with Buildroot, moved to https://github.com/bargees/barge
GNU General Public License v2.0
53 stars 7 forks source link

How to add node #33

Closed fnicastri closed 8 years ago

fnicastri commented 8 years ago

Hi,

I was trying to install node in docker-root for using it with wocker as pipeline build tool. I've managed to build a new image with node but can't include the necessary libs (libstdc++). I can install the libs in the docker-root-builder but can't retain these in the vagrant box.

Thank you Francesco

ailispaw commented 8 years ago

Hi @fnicastri ,

I don't know what pipeline build tool is and how to use it with wocker. It's a long way to install node into the DockerRoot box. You had better install node into a Docker image, because wocker is based on Docker and DockerRoot is designed for Docker environment.

Otherwise, You need to modify the buildroot configuration file in this repo. https://github.com/ailispaw/docker-root/blob/master/configs/buildroot.config (I guess you mean nodejs.)

BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_INSTALL_LIBSTDCPP=y
BR2_PACKAGE_NODEJS=y
BR2_PACKAGE_NODEJS_NPM=y

And then you have to use https://github.com/ailispaw/docker-root-packer to make a vagrant box for it.


Or you may want to install node into the wocker container.

# at wocker folder.
$ vagrant ssh
wocker ~ $ docker exec -it wocker bash
root@67ac4363da81:/var/www/wordpress# apt-get update
root@67ac4363da81:/var/www/wordpress# apt-get install nodejs
ailispaw commented 8 years ago

I will consider supporting c++ in https://github.com/ailispaw/docker-root-pkg to build a package which needs c++ as well.

ailispaw commented 8 years ago

I made a special workaround and package for you. Note: You must has the latest DockerRoot box (v1.3.8).

To install libstdc++ and nodejs;

# at wocker folder.
$ vagrant ssh
wocker ~ $ sudo pkg install libstdcxx
wocker ~ $ wget https://nodejs.org/download/release/v5.10.1/node-v5.10.1-linux-x64.tar.xz
wocker ~ $ wget https://nodejs.org/download/release/v5.10.1/SHASUMS256.txt
wocker ~ $ grep node-v5.10.1-linux-x64.tar.xz SHASUMS256.txt | sha256sum -c -
node-v5.10.1-linux-x64.tar.xz: OK
wocker ~ $ tar Jxf node-v5.10.1-linux-x64.tar.xz
wocker ~ $ sudo chown -R root:root node-v5.10.1-linux-x64
wocker ~ $ cd node-v5.10.1-linux-x64
wocker ~ $ sudo cp -dpfr bin include lib share /usr

After vagrant halt or vagrant destroy and vagrant up, you need to install libstdc++ and nodejs again.

# at wocker folder.
$ vagrant ssh
wocker ~ $ sudo pkg install libstdcxx
wocker ~ $ cd node-v5.10.1-linux-x64 && sudo cp -dpfr bin include lib share /usr

You can put the last 2 lines as the vagrant shell provisioner in Vagrantfile for convenience.

ailispaw commented 8 years ago

Anyway DockerRoot is a special OS for Docker host VM, so I strongly recommend using Docker images instead of installing tools in the VM directly.

# at wocker folder.
$ vagrant ssh
wocker ~ $ docker run -it --rm --name nodejs node
> 

Cf.) https://hub.docker.com/_/node/

Thanks. :)

ailispaw commented 8 years ago

Now https://github.com/ailispaw/docker-root-pkg support packages which need C++.

fnicastri commented 8 years ago

Hi ailispaw, sorry for the huge late but was a really busy time at work.

Thank you again for tour time and help!

Francesco