diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..5f39c0f --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,26 @@ +{ + "root": true, + "env": { + "browser": true, + "es2021": true, + "node": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], + "@typescript-eslint/ban-ts-comment": "off" + }, + "ignorePatterns": ["dist", "node_modules", "*.html"] +} diff --git a/Dockerfile b/Dockerfile index 74c7b34..8b957ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,24 +8,33 @@ COPY packages/server/package.json packages/server/ COPY apps/launcher/package.json apps/launcher/ COPY apps/edocs/package.json apps/edocs/ COPY apps/enotes/package.json apps/enotes/ -RUN npm install -g pnpm && pnpm install --workspace=packages/core --workspace=packages/ebot-client --workspace=packages/server --workspace=apps/launcher --workspace=apps/edocs --workspace=apps/enotes + +RUN npm install -g pnpm && \ + pnpm install --workspace=packages/core --workspace=packages/ebot-client --workspace=packages/server --workspace=apps/launcher --workspace=apps/edocs --workspace=apps/enotes + COPY . . -RUN pnpm run build --filter=@eoffice/core -RUN pnpm run build --filter=@eoffice/ebot-client -RUN pnpm run build --filter=@eoffice/server -RUN pnpm run build --filter=@eoffice/launcher -RUN pnpm run build --filter=@eoffice/edocs -RUN pnpm run build --filter=@eoffice/enotes +RUN pnpm run build --filter=@eoffice/core && \ + pnpm run build --filter=@eoffice/ebot-client && \ + pnpm run build --filter=@eoffice/server && \ + pnpm run build --filter=@eoffice/launcher && \ + pnpm run build --filter=@eoffice/edocs && \ + pnpm run build --filter=@eoffice/enotes # Production stage FROM node:20-alpine AS production WORKDIR /app ENV NODE_ENV=production + COPY --from=builder /app/packages/server/dist ./server/ COPY --from=builder /app/apps/launcher/dist ./public/launcher/ COPY --from=builder /app/apps/edocs/dist ./public/edocs/ COPY --from=builder /app/apps/enotes/dist ./public/enotes/ COPY --from=builder /app/packages/server/package.json ./ -RUN npm install -g pnpm && pnpm install --prod + +RUN npm install -g pnpm && \ + pnpm install --prod && \ + chown -R node:node /app + +USER node EXPOSE 3001 CMD ["node", "server/index.js"] diff --git a/enterprise/docker/Dockerfile b/enterprise/docker/Dockerfile index 59b4abc..9e71bd3 100644 --- a/enterprise/docker/Dockerfile +++ b/enterprise/docker/Dockerfile @@ -3,9 +3,10 @@ LABEL maintainer="embeddedos-org" description="Office Suite — EoS Enterprise" WORKDIR /app COPY package*.json ./ -RUN npm install -g pnpm && pnpm install --prod +RUN npm install -g pnpm && pnpm install --prod && chown -R node:node /app COPY . . +USER node EXPOSE 8080 HEALTHCHECK --interval=30s --timeout=5s CMD wget -qO- http://localhost:8080/health || exit 1 CMD ["node", "server.js"] diff --git a/package.json b/package.json index 8130c24..c68013c 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "build": "npm run build --workspaces", "test": "npm run test --workspaces --if-present", "lint": "eslint . --ext .ts,.tsx --max-warnings 0", + "typecheck": "pnpm -r exec tsc --noEmit", "clean": "rm -rf node_modules packages/*/dist apps/*/dist" }, "devDependencies": {