fix: fix port not defaulting to 4002, add server.js (#976)

fixes #972
This commit is contained in:
Nolan Lawson 2019-02-12 23:12:50 -08:00 committed by GitHub
parent f6e9d714d3
commit 2adf8a738e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View file

@ -22,4 +22,4 @@ EXPOSE 4002
# Setting run-command, using explicit `node` command # Setting run-command, using explicit `node` command
# rather than `yarn` or `npm` to use less memory # rather than `yarn` or `npm` to use less memory
# https://github.com/nolanlawson/pinafore/issues/971 # https://github.com/nolanlawson/pinafore/issues/971
CMD PORT=4002 node __sapper__/build CMD PORT=4002 node server.js

View file

@ -64,7 +64,7 @@ Then build:
Then run: Then run:
PORT=4002 node __sapper__/build PORT=4002 node server.js
### Docker ### Docker

View file

@ -12,7 +12,7 @@
"build": "cross-env NODE_ENV=production run-s build-steps", "build": "cross-env NODE_ENV=production run-s build-steps",
"build-steps": "run-s before-build sapper-build", "build-steps": "run-s before-build sapper-build",
"sapper-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-and-start": "run-s build start",
"build-template-html": "node -r esm ./bin/build-template-html.js", "build-template-html": "node -r esm ./bin/build-template-html.js",
"build-template-html-watch": "node -r esm ./bin/build-template-html.js --watch", "build-template-html-watch": "node -r esm ./bin/build-template-html.js --watch",

5
server.js Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env node
process.env.PORT = process.env.PORT || 4002
require('./__sapper__/build')