Merge remote-tracking branch 'andyshinn/fix_doker_support'

This commit is contained in:
Thaddee Tyl 2015-10-07 14:01:41 +02:00
commit f8ba6b0610
2 changed files with 28 additions and 14 deletions

View File

@ -1,15 +1,3 @@
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y node npm
RUN apt-get update && apt-get install -y libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++
RUN npm cache clean -f
RUN npm install -g n
RUN n stable
RUN npm install canvas
RUN mkdir -p /var/app
ADD package.json /var/app/package.json
RUN cd /var/app && npm install
ADD . /var/app
FROM node:0.12.7-onbuild
ENV INFOSITE http://shields.io
WORKDIR /var/app
CMD npm run start
EXPOSE 80

View File

@ -127,6 +127,32 @@ make deploy
heroku open
```
# Docker
You can build and run the server locally using Docker. First build an image:
```console
$ build -t shields ./
Sending build context to Docker daemon 3.923 MB
Step 0 : FROM node:0.12.7-onbuild
Removing intermediate container c4678889953f
Successfully built 4471b442c220
```
Then run the container:
```console
$ docker run --rm -p 8080:80 shields
> gh-badges@1.1.2 start /usr/src/app
> node server.js
http://[::1]:80/try.html
```
Assuming Docker is running locally, you should be able to get to the application at http://localhost:8080/try.html. If you run Docker in a virtual machine (such as boot2docker or Docker Machine) then you will need to replace `localhost` with the actual IP address of that virtual machine.
# Links
See <https://github.com/h5bp/lazyweb-requests/issues/150> for a story of the