artificialio / docker-sails

Docker container for SailsJS, optionally managed by PM2
https://registry.hub.docker.com/u/artificial/docker-sails/
26 stars 7 forks source link

[nvm-iojs-latest] Cannot start, no sails #11

Open IanVS opened 9 years ago

IanVS commented 9 years ago

I'm trying to use nvm-iojs-latest in SANE, but getting the error message:

Cannot start container ee8a1d088eedcb4207730cfe35bca16557ef204c7d561766251bf53129b8d86c: exec: "sails": executable file not found in $PATH

This is the docker-compose.yml:

server:
  image: artificial/docker-sails:iojs-nvm-stable
  command: sails lift
  volumes:
    - server/:/server
  ports:
    - "1337:1337"
kriswill commented 9 years ago

It doesn't work for a few reasons.

  1. nvm is initialized in the .bashrc, which is only executed in interactive shells.
  2. even with nvm active, if I force an interactive shell, sails won't lift, because grunt isn't installed globally.

you can manually test this with:

kris ~/src/oss/test-sane-docker 
→ docker run --rm -v `pwd`/server/:/server -it artificial/docker-sails:iojs-nvm-stable bash -i -c "sails lift"

if there is a way to disable the grunt-coffescript hooking that sails lift does, it will work. In which case, you can simply modify the docker-compose.yml to include:

server:
  image: artificial/docker-sails:iojs-nvm-stable
  command: bash -i -c "sails lift"
  volumes:
    - server/:/server
  ports:
    - "1337:1337"

keep in mind, the current build of the iojs-nvm-stable is built with iojs 1.5.1 and an older version of sails. If I have some time tomorrow I'll see if I can update it.

kriswill commented 9 years ago

P.S., upon reflection perhaps using nvm to install node into these images is not a good way to use a Docker image in sane. I think it would be better and more efficient to just bake in the version of node you want to use, while it would be convenient for switching node versions in a single docker container, it's just as easy to switch which image you want for the node base.

I'll discuss with @Globegitter the next time we chat.

Globegitter commented 9 years ago

@kriswill yeah I think removing nvm does sound like a good decision. If you have some time in-between your hiatus, that would be a great update. Would love to have it in 0.1.0 :)