Setup multistage build to allow running backend server in dev mode so we dont have to run it outside Docker

This will automatically restart the backend server in docker anytime there are changes to the original
source files instead of copying over when running in dev mode. In production, it will still do the
normal copy/build.
This commit is contained in:
Hammad Jutt
2020-07-05 21:07:28 -06:00
parent 675c0e0046
commit 5cfd7d88dd
7 changed files with 64 additions and 42 deletions

View File

@@ -7,7 +7,7 @@
"start": "yarn start:backend",
"start:backend": "node ./dist/index.js",
"start:backend:dev": "yarn dev",
"dev": "ts-node-dev --respawn --transpileOnly src/index.ts",
"dev": "ts-node-dev --exit-child --respawn --transpileOnly src/index.ts",
"typecheck": "tsc --noEmit",
"build": "tsc"
},
@@ -19,13 +19,13 @@
"body-parser": "^1.19.0",
"ethers": "^4.0.46",
"express": "^4.17.1",
"node-fetch": "^2.6.0",
"ts-node-dev": "^1.0.0-pre.44"
"node-fetch": "^2.6.0"
},
"devDependencies": {
"@types/express": "^4.17.6",
"@types/node": "^13.11.1",
"@types/node-fetch": "^2.5.6",
"ts-node-dev": "^1.0.0-pre.50",
"typescript": "^3.8.3"
}
}

View File

@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"rootDir": "./src",
"outDir": "./dist",
"typeRoots": [
"../@types", "../../node_modules/@types"]

View File

@@ -10,7 +10,7 @@
"start:backend:dev": "yarn watch",
"prepare": "yarn build",
"build": "tsc",
"watch": "tsc"
"watch": "tsc -w"
},
"dependencies": {
"ethers": "^4.0.47",