Minh Nguyen 5 years ago
parent
commit
0e1c9cb583
4 changed files with 29 additions and 2 deletions
  1. 14
    0
      Dockerfile
  2. 4
    1
      package.json
  3. 9
    0
      scripts/postinstall.js
  4. 2
    1
      tsconfig.json

+ 14
- 0
Dockerfile View File

@@ -0,0 +1,14 @@
1
+FROM node:14-alpine
2
+
3
+WORKDIR /excalidraw-room
4
+
5
+COPY package.json yarn.lock ./
6
+COPY scripts ./scripts
7
+RUN SKIP_YARN_POSTINSTALL=true yarn
8
+
9
+COPY tsconfig.json ./
10
+COPY src ./src
11
+RUN yarn build
12
+
13
+EXPOSE 80
14
+CMD ["yarn", "start"]

+ 4
- 1
package.json View File

@@ -7,7 +7,7 @@
7 7
     "build": "tsc",
8 8
     "fix": "yarn prettier --write",
9 9
     "lint": "yarn prettier --list-different",
10
-    "postinstall": "npm run build",
10
+    "postinstall": "node scripts/postinstall.js",
11 11
     "prettier": "prettier \"**/*.{ts,md,json,yaml,yml}\"",
12 12
     "start": "node dist/index.js",
13 13
     "test": "yarn lint"
@@ -40,6 +40,9 @@
40 40
     "typescript": "3.9.5"
41 41
   },
42 42
   "eslintConfig": {
43
+    "env": {
44
+      "es6": true
45
+    },
43 46
     "extends": [
44 47
       "prettier"
45 48
     ],

+ 9
- 0
scripts/postinstall.js View File

@@ -0,0 +1,9 @@
1
+// There doesn't appear to be a way to skip `postinstall`,
2
+// as doing `yarn --ignore-scripts` could prevent native packages from building:
3
+// https://github.com/yarnpkg/yarn/issues/4100
4
+
5
+const { execSync } = require("child_process");
6
+
7
+if (process.env.SKIP_YARN_POSTINSTALL !== "true") {
8
+  execSync("yarnpkg build", { stdio: "inherit" });
9
+}

+ 2
- 1
tsconfig.json View File

@@ -12,5 +12,6 @@
12 12
     "resolveJsonModule": true,
13 13
     "isolatedModules": true,
14 14
     "outDir": "dist"
15
-  }
15
+  },
16
+  "include": ["src/**/*"]
16 17
 }

Loading…
Cancel
Save