From e85eca1b6676e9fb49228d427b6ab3e7c433360a Mon Sep 17 00:00:00 2001 From: Vladislav Sabanov Date: Sat, 27 Apr 2019 01:41:12 +0500 Subject: [PATCH] Fix dockerfile and readme (#282) * Fix dockerfile and readme * Fix up --- docker/front/Dockerfile | 4 ++++ front/README.md | 23 +++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docker/front/Dockerfile b/docker/front/Dockerfile index 9473d52..14a1c13 100644 --- a/docker/front/Dockerfile +++ b/docker/front/Dockerfile @@ -6,6 +6,10 @@ ENV LC_ALL=C.UTF-8 # NODE_ENV used to run front server on production ENV NODE_ENV=production +# Overrides for variables in front/config.js +ENV API_URL=https://staging.guide.aelve.com:4400 +ENV PORT=5000 + # Install NodeJS via nvm # replace shell with bash so we can source files diff --git a/front/README.md b/front/README.md index ea278d6..64cdbcd 100644 --- a/front/README.md +++ b/front/README.md @@ -1,15 +1,18 @@ ## Commands - - `dev` - Start developing environment (starts both server and setup client middleware for server). - - `build` - Builds to /dist folder. Compiles (from ts to js) server right in dist folder, client files compiled in /dist/src. +- `dev` - Start developing environment (starts both server and setup client middleware for server). +- `build` - Builds to /dist folder. Compiles (from ts to js) server right in dist folder, client files compiled in /dist/src. ## Deploy process - Node version >= 11, because used fs async methods which experimental now + Requirements: Node version should be >= 11, because of using fs async methods which experimental now. - - `git pull` - - `npm i` - - `npm run build` - - `set NODE_ENV=production`, also you can specify port by `set PORT=%port_number%` and `API_URL=%api_url%` - - `cd dist` - - `npm i` - - `node server` +1. `git pull` +2. `npm i` + +3. Now you have a choice how to set PORT and API_URL. Either set them in front/config.js, or use export (set) PORT=%port_number% API_URL=%api_url% (for example "http://localhost:4400" quotes matter) with dev commands. + +4. `npm run build` +5. `cd dist` +6. `npm i` +7. `export (set) NODE_ENV=production` +8. `node server`