fix docker issues on edr

This commit is contained in:
SennayT
2026-05-14 11:43:49 +03:00
parent 4bdcefe8e0
commit c3f0219eea
7 changed files with 1591 additions and 1134 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
**/node_modules
**/dist
**/.github
**/.vscode
**/.git
**/.env
.env

2
.npmrc Normal file
View File

@@ -0,0 +1,2 @@
@tria-plc:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=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

78
Dockerfile Normal file
View File

@@ -0,0 +1,78 @@
FROM node:24.15.0-alpine AS base
RUN corepack enable && corepack prepare pnpm@latest-11 --activate
WORKDIR /app
FROM base AS deps
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
COPY apps/edr-freight-api/package.json ./apps/edr-freight-api/
COPY apps/edr-passenger-api/package.json ./apps/edr-passenger-api/
COPY apps/edr-freight-web/backoffice/package.json ./apps/edr-freight-web/backoffice/
COPY apps/edr-freight-web/portal/package.json ./apps/edr-freight-web/portal/
COPY apps/edr-passenger-web/backoffice/package.json ./apps/edr-passenger-web/backoffice/
COPY apps/edr-passenger-web/portal/package.json ./apps/edr-passenger-web/portal/
COPY packages/api-common/package.json packages/api-common/
COPY packages/config/eslint-config/package.json packages/config/eslint-config/
COPY packages/config/prettier-config/package.json packages/config/prettier-config/
COPY packages/config/tsconfig/package.json packages/config/tsconfig/
COPY packages/types/package.json packages/types/
COPY packages/ui-common/package.json packages/ui-common/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store\
--mount=type=secret,id=npmrc,target=./.npmrc \
pnpm install --frozen-lockfile
FROM deps AS build
COPY . .
# ENV CI=true
RUN pnpm run build
RUN find . -name "main.js"
FROM base AS freight-api
# RUN corepack enable && corepack prepare pnpm@9.12.0 --activate
WORKDIR /app/apps/edr-freight-api
ENV NODE_ENV=production
COPY --from=deps /app/node_modules ./../../node_modules
COPY --from=deps /app/apps/edr-freight-api/node_modules ./node_modules
COPY --from=build /app/apps/edr-freight-api/dist ./dist
COPY --from=build /app/apps/edr-freight-api/package.json ./package.json
COPY --from=build /app/packages ./../../packages
EXPOSE 3001
CMD ["node", "dist/main.js"]
FROM base AS passenger-api
# RUN corepack enable && corepack prepare pnpm@9.12.0 --activate
WORKDIR /app/apps/edr-passenger-api
ENV NODE_ENV=production
COPY --from=deps /app/node_modules ./../../node_modules
COPY --from=deps /app/apps/edr-passenger-api/node_modules ./node_modules
COPY --from=build /app/apps/edr-passenger-api/dist ./dist
COPY --from=build /app/apps/edr-passenger-api/package.json ./package.json
COPY --from=build /app/packages ./../../packages
EXPOSE 3001
CMD ["node", "dist/main.js"]
FROM nginx:1.27-alpine AS freight-web-portal
COPY --from=build /app/apps/edr-freight-web/portal/dist /usr/share/nginx/html
EXPOSE 5173
CMD ["nginx", "-g", "daemon off;"]
FROM nginx:1.27-alpine AS freight-web-backoffice
COPY --from=build /app/apps/edr-freight-web/backoffice/dist /usr/share/nginx/html
EXPOSE 5173
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -6,7 +6,9 @@ FROM base AS deps
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./ COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
COPY apps/edr-freight-api/package.json ./apps/edr-freight-api/ COPY apps/edr-freight-api/package.json ./apps/edr-freight-api/
COPY packages ./packages COPY packages ./packages
RUN pnpm install --frozen-lockfile --filter @edr/freight-api... RUN --mount=type=cache,id=pnpm,target=/pnpm/store\
--mount=type=secret,id=npmrc,target=./.npmrc \
pnpm install --frozen-lockfile --filter @edr/freight-api...
FROM deps AS build FROM deps AS build
COPY apps/edr-freight-api ./apps/edr-freight-api COPY apps/edr-freight-api ./apps/edr-freight-api

View File

@@ -42,7 +42,7 @@
"prettier --write" "prettier --write"
] ]
}, },
"packageManager": "pnpm@9.12.0", "packageManager": "pnpm@11.1.1+sha512.d1fdf5f73c617b64fa1a56a81c3c8dfe0e966e33a6010aa256b517ae77be21d93e05affc0de1a83b0e4f29d569f68b446ae8f068cd7247c0bb3df0fb4d7bdf9a",
"engines": { "engines": {
"node": ">=20" "node": ">=20"
} }

2618
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,3 +5,17 @@ packages:
- "apps/edr-passenger-web/*" - "apps/edr-passenger-web/*"
- "packages/*" - "packages/*"
- "packages/config/*" - "packages/config/*"
allowBuilds:
'@nestjs/core': true
'@prisma/client': true
'@prisma/engines': true
'@scarf/scarf': true
argon2: true
bcrypt: true
core-js: true
es5-ext: true
esbuild: true
highlight.js: true
prisma: true
tesseract.js: true
uglifyjs-webpack-plugin: true