diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eb8ecc9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM node:14-alpine + +WORKDIR /excalidraw-room + +COPY package.json yarn.lock ./ +COPY scripts ./scripts +RUN SKIP_YARN_POSTINSTALL=true yarn + +COPY tsconfig.json ./ +COPY src ./src +RUN yarn build + +EXPOSE 80 +CMD ["yarn", "start"] diff --git a/package.json b/package.json index 807d4a0..12292e4 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build": "tsc", "fix": "yarn prettier --write", "lint": "yarn prettier --list-different", - "postinstall": "npm run build", + "postinstall": "node scripts/postinstall.js", "prettier": "prettier \"**/*.{ts,md,json,yaml,yml}\"", "start": "node dist/index.js", "test": "yarn lint" @@ -40,6 +40,9 @@ "typescript": "3.9.5" }, "eslintConfig": { + "env": { + "es6": true + }, "extends": [ "prettier" ], diff --git a/scripts/postinstall.js b/scripts/postinstall.js new file mode 100644 index 0000000..e14b318 --- /dev/null +++ b/scripts/postinstall.js @@ -0,0 +1,9 @@ +// There doesn't appear to be a way to skip `postinstall`, +// as doing `yarn --ignore-scripts` could prevent native packages from building: +// https://github.com/yarnpkg/yarn/issues/4100 + +const { execSync } = require("child_process"); + +if (process.env.SKIP_YARN_POSTINSTALL !== "true") { + execSync("yarnpkg build", { stdio: "inherit" }); +} diff --git a/tsconfig.json b/tsconfig.json index a239fb1..54b76ae 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,5 +12,6 @@ "resolveJsonModule": true, "isolatedModules": true, "outDir": "dist" - } + }, + "include": ["src/**/*"] }