mgenev / how-to-sane

A demonstration of how to use the SANE stack
http://howtosane.ninja
MIT License
163 stars 22 forks source link

How do you run npm install to properly get bcrypt? #92

Closed maxscott closed 9 years ago

maxscott commented 9 years ago

I'm currently running from boot2docker on my mac, and attempting to npm install on the image actually fails due to missing $PYTHON, which I can't seem to install, but isn't a part of the stock docker-sails image. Was wondering how you got around that, or if I'm just completely missing something.. Thanks!

BransonGitomeh commented 9 years ago

@maxwerr to properly get Bycrypt, my experience is that it works best with npm 0.10.x

IanVS commented 9 years ago

boot2docker is deprecated, and replaced with docker toolbox. I'd suggest giving that a try and see if it helps. I don't have a mac though, so I have no personal experience with it.

kriswill commented 9 years ago

You can also use a custom Dockerfile for your sails container. for example:

FROM iojs:3.2.0 

RUN mkdir -p /server \
  && npm install -g sails

VOLUME ["/server"]
WORKDIR /server
EXPOSE 1337
CMD ["sails", "lift"]

Then, in your docker-compose.yml:

server:
  build: ./server
  volumes:
    - ./server/:/server
  ports:
    - "1337:1337"
  links:
    - db

Then to install the node modules (from your sane root):

→ docker-compose run server npm install

Any modules that are native in any dependency you are using will be compiled within the container, including bcrypt.

maxscott commented 9 years ago

re: @IanVS I see that now--the standard docker-sails image used in sane requires boot2docker though :( so maybe if I use the custom dockerfile as outlined by @kriswill !? Thanks for the tips :moneybag: