Added Dockerfile (#313)

* Added Dockerfile

* Better comments in Dockerfile

* Added SIGINT handler

* Keeping code-check happy

* Keeping code-check happy v2

* Keeping code-check happy v2
This commit is contained in:
Koyu Berteon 2018-05-25 04:59:48 +02:00 committed by Nolan Lawson
parent 4813bee9a4
commit d79de35603
3 changed files with 35 additions and 0 deletions

23
Dockerfile Normal file
View file

@ -0,0 +1,23 @@
# Using Alpine to keep the images smaller
FROM alpine:latest
# Pushing all files into image
WORKDIR /app
ADD . /app
# Install updates and NodeJS+Dependencies
RUN apk update && apk upgrade
RUN apk add nodejs git python build-base clang
# Upgrading NPM
RUN npm i npm@latest -g
# Install Pinafore
RUN npm install
RUN npm run build
# Expose port 4002
EXPOSE 4002
# Setting run-command
CMD PORT=4002 npm start

View file

@ -59,6 +59,13 @@ To build Pinafore for production:
npm run build
PORT=4002 npm start
### Docker
To build a docker image for production:
docker build .
docker run -d -p 4002:4002 [your-image]
Now Pinafore is running at `localhost:4002`.
Pinafore requires [Node.js](https://nodejs.org/en/) v8+.

View file

@ -63,3 +63,8 @@ app.use(sapper())
app.listen(PORT, () => {
console.log(`listening on port ${PORT}`)
})
// Handle SIGINT (source: https://git.io/vhJgF)
process.on('SIGINT', function () {
process.exit(0)
})