Skip to content

Commit fd068d5

Browse files
authored
fix(ci): harden docker images and fix build/lint/typecheck (#2)
1 parent 1b31a1d commit fd068d5

4 files changed

Lines changed: 46 additions & 9 deletions

File tree

.eslintrc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"browser": true,
5+
"es2021": true,
6+
"node": true
7+
},
8+
"extends": [
9+
"eslint:recommended",
10+
"plugin:@typescript-eslint/recommended"
11+
],
12+
"parser": "@typescript-eslint/parser",
13+
"parserOptions": {
14+
"ecmaVersion": "latest",
15+
"sourceType": "module"
16+
},
17+
"plugins": [
18+
"@typescript-eslint"
19+
],
20+
"rules": {
21+
"@typescript-eslint/no-explicit-any": "off",
22+
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
23+
"@typescript-eslint/ban-ts-comment": "off"
24+
},
25+
"ignorePatterns": ["dist", "node_modules", "*.html"]
26+
}

Dockerfile

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,33 @@ COPY packages/server/package.json packages/server/
88
COPY apps/launcher/package.json apps/launcher/
99
COPY apps/edocs/package.json apps/edocs/
1010
COPY apps/enotes/package.json apps/enotes/
11-
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
11+
12+
RUN npm install -g pnpm && \
13+
pnpm install --workspace=packages/core --workspace=packages/ebot-client --workspace=packages/server --workspace=apps/launcher --workspace=apps/edocs --workspace=apps/enotes
14+
1215
COPY . .
13-
RUN pnpm run build --filter=@eoffice/core
14-
RUN pnpm run build --filter=@eoffice/ebot-client
15-
RUN pnpm run build --filter=@eoffice/server
16-
RUN pnpm run build --filter=@eoffice/launcher
17-
RUN pnpm run build --filter=@eoffice/edocs
18-
RUN pnpm run build --filter=@eoffice/enotes
16+
RUN pnpm run build --filter=@eoffice/core && \
17+
pnpm run build --filter=@eoffice/ebot-client && \
18+
pnpm run build --filter=@eoffice/server && \
19+
pnpm run build --filter=@eoffice/launcher && \
20+
pnpm run build --filter=@eoffice/edocs && \
21+
pnpm run build --filter=@eoffice/enotes
1922

2023
# Production stage
2124
FROM node:20-alpine AS production
2225
WORKDIR /app
2326
ENV NODE_ENV=production
27+
2428
COPY --from=builder /app/packages/server/dist ./server/
2529
COPY --from=builder /app/apps/launcher/dist ./public/launcher/
2630
COPY --from=builder /app/apps/edocs/dist ./public/edocs/
2731
COPY --from=builder /app/apps/enotes/dist ./public/enotes/
2832
COPY --from=builder /app/packages/server/package.json ./
29-
RUN npm install -g pnpm && pnpm install --prod
33+
34+
RUN npm install -g pnpm && \
35+
pnpm install --prod && \
36+
chown -R node:node /app
37+
38+
USER node
3039
EXPOSE 3001
3140
CMD ["node", "server/index.js"]

enterprise/docker/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ LABEL maintainer="embeddedos-org" description="Office Suite — EoS Enterprise"
33

44
WORKDIR /app
55
COPY package*.json ./
6-
RUN npm install -g pnpm && pnpm install --prod
6+
RUN npm install -g pnpm && pnpm install --prod && chown -R node:node /app
77
COPY . .
88

9+
USER node
910
EXPOSE 8080
1011
HEALTHCHECK --interval=30s --timeout=5s CMD wget -qO- http://localhost:8080/health || exit 1
1112
CMD ["node", "server.js"]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"build": "npm run build --workspaces",
3838
"test": "npm run test --workspaces --if-present",
3939
"lint": "eslint . --ext .ts,.tsx --max-warnings 0",
40+
"typecheck": "pnpm -r exec tsc --noEmit",
4041
"clean": "rm -rf node_modules packages/*/dist apps/*/dist"
4142
},
4243
"devDependencies": {

0 commit comments

Comments
 (0)