Skip to content

Commit

Permalink
Add Dockerfile (kriasoft#1038)
Browse files Browse the repository at this point in the history
Update package.json/name, then: npm run build -- --release --docker
  • Loading branch information
koistya authored Dec 20, 2016
1 parent b8db8e1 commit 074954e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:7.2.1-alpine

COPY ./build /srv/www
WORKDIR /srv/www

RUN npm install --production --silent

CMD [ "node", "server.js" ]
7 changes: 7 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ or, for a production build:
```shell
$ npm run build -- --release
```

or, for a production docker build:

```shell
$ npm run build -- --release --docker
```

*NOTE: double dashes are required*

After running this command, the `/build` folder will contain the compiled
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "web",
"version": "0.0.0",
"private": true,
"engines": {
"node": ">=6.5",
Expand Down
6 changes: 6 additions & 0 deletions tools/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
* LICENSE.txt file in the root directory of this source tree.
*/

import cp from 'child_process';
import run from './run';
import clean from './clean';
import copy from './copy';
import bundle from './bundle';
import render from './render';
import pkg from '../package.json';

/**
* Compiles the project from source files into a distributable
Expand All @@ -25,6 +27,10 @@ async function build() {
if (process.argv.includes('--static')) {
await run(render);
}

if (process.argv.includes('--docker')) {
cp.spawnSync('docker', ['build', '-t', pkg.name, '.'], { stdio: 'inherit' });
}
}

export default build;

0 comments on commit 074954e

Please sign in to comment.