From 2adf8a738ec2ef4f01750d1929833dbb37ca843c Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 12 Feb 2019 23:12:50 -0800 Subject: [PATCH] fix: fix port not defaulting to 4002, add server.js (#976) fixes #972 --- Dockerfile | 2 +- README.md | 2 +- package.json | 2 +- server.js | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100755 server.js diff --git a/Dockerfile b/Dockerfile index cb9df77a..c2367c8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,4 +22,4 @@ EXPOSE 4002 # Setting run-command, using explicit `node` command # rather than `yarn` or `npm` to use less memory # https://github.com/nolanlawson/pinafore/issues/971 -CMD PORT=4002 node __sapper__/build +CMD PORT=4002 node server.js diff --git a/README.md b/README.md index c913bd53..34c8331f 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Then build: Then run: - PORT=4002 node __sapper__/build + PORT=4002 node server.js ### Docker diff --git a/package.json b/package.json index bdf3a682..05885c7d 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "build": "cross-env NODE_ENV=production run-s build-steps", "build-steps": "run-s before-build sapper-build", "sapper-build": "sapper build", - "start": "PORT=4002 node __sapper__/build", + "start": "node server.js", "build-and-start": "run-s build start", "build-template-html": "node -r esm ./bin/build-template-html.js", "build-template-html-watch": "node -r esm ./bin/build-template-html.js --watch", diff --git a/server.js b/server.js new file mode 100755 index 00000000..8d113f6b --- /dev/null +++ b/server.js @@ -0,0 +1,5 @@ +#!/usr/bin/env node + +process.env.PORT = process.env.PORT || 4002 + +require('./__sapper__/build')