Skip to content

Commit

Permalink
Install dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jdleesmiller committed Mar 6, 2016
1 parent 48235d9 commit 8e04ac1
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ RUN useradd --user-group --create-home --shell /bin/false app &&\

ENV HOME=/home/app

COPY package.json npm-shrinkwrap.json $HOME/chat/

This comment has been minimized.

Copy link
@sebastienbarre

sebastienbarre May 3, 2016

Great tutorial, though at this point in the document it was unclear to me as to why you need to do this. I thought that

volumes:
    - .:/home/app/chat

would already expose all files in the current host directory to the container, and vice-versa. Since we already have the .json files on the host, and the volume shares them, why the COPY? Thx.

This comment has been minimized.

Copy link
@jdleesmiller

jdleesmiller May 3, 2016

Author Owner

That's a good question. My understanding is that this is an issue of timing: when docker is building an image from the Dockerfile, it doesn't get any of the settings in the docker-compose.yml file. Those settings are applied later when the image is used to start containers. Does that help?

This comment has been minimized.

Copy link
@sebastienbarre

sebastienbarre May 3, 2016

I think that's indeed the reason, thanks!

RUN chown -R app:app $HOME/*

USER app
WORKDIR $HOME/chat
RUN npm install
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ chat:
command: echo 'ready'
volumes:
- .:/home/app/chat
- /home/app/chat/node_modules
186 changes: 185 additions & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
},
"keywords": [],
"author": "",
"license": "ISC"
"license": "ISC",
"dependencies": {
"express": "^4.10.2"
}
}

0 comments on commit 8e04ac1

Please sign in to comment.