fix broken Dockerfile to use official node image instead

This commit is contained in:
Andy Shinn 2015-09-21 09:52:18 -05:00
parent 5f475f107b
commit 5335c872a0
2 changed files with 28 additions and 14 deletions

View File

@ -1,15 +1,3 @@
FROM ubuntu:14.04 FROM node:0.12.7-onbuild
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
ENV INFOSITE http://shields.io ENV INFOSITE http://shields.io
WORKDIR /var/app EXPOSE 80
CMD npm run start

View File

@ -127,6 +127,32 @@ make deploy
heroku open 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 # Links
See <https://github.com/h5bp/lazyweb-requests/issues/150> for a story of the See <https://github.com/h5bp/lazyweb-requests/issues/150> for a story of the