Skip to content

Commit c90add4

Browse files
authored
merge changes (#123)
1 parent 4ae0396 commit c90add4

File tree

368 files changed

+58965
-2788
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

368 files changed

+58965
-2788
lines changed

apps/api-gateway/Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# local-test/api-gateway.Dockerfile
21
# Using a consistent base for all stages
32
ARG BASE_IMAGE=node:22-alpine
3+
# hadolint ignore=DL3006
44
FROM ${BASE_IMAGE} AS builder
55

66
ARG DIR=/usr/src/app
@@ -12,30 +12,35 @@ RUN yarn global add turbo@^2.0.3
1212
RUN turbo prune api-gateway --docker && rm -f .npmrc
1313

1414
# Installing the isolated workspace
15+
# hadolint ignore=DL3006
1516
FROM ${BASE_IMAGE} AS installer
1617
ARG DIR=/usr/src/app
1718
WORKDIR $DIR
1819
COPY --from=builder $DIR/out/json/ .
1920
COPY --from=builder $DIR/out/yarn.lock ./yarn.lock
2021
COPY --from=builder $DIR/turbo.json ./turbo.json
2122
COPY --from=builder $DIR/packages ./packages
22-
RUN yarn install --ignore-scripts --frozen-lockfile --network-timeout 600000
23+
RUN yarn install --ignore-scripts --frozen-lockfile
2324

2425
# Running build using turbo
26+
# hadolint ignore=DL3006
2527
FROM ${BASE_IMAGE} AS sourcer
2628
ARG DIR=/usr/src/app
2729
WORKDIR $DIR
2830
COPY --from=installer $DIR/ .
2931
COPY --from=builder $DIR/out/full/ .
3032
COPY --from=builder /usr/local/share/.config/yarn/global /usr/local/share/.config/yarn/global
31-
RUN yarn build --filter=api-gateway && yarn install --production --ignore-scripts --frozen-lockfile --network-timeout 600000
33+
RUN yarn build --filter=api-gateway && yarn install --production --ignore-scripts --frozen-lockfile
3234

3335
# Production stage
36+
# hadolint ignore=DL3006
3437
FROM ${BASE_IMAGE} AS production
3538
ARG DIR=/usr/src/app
3639
ENV NODE_ENV production
3740
WORKDIR $DIR
38-
RUN apk add --no-cache dumb-init
41+
RUN apk add --no-cache dumb-init~=1
42+
COPY --chown=node:node --from=sourcer $DIR/apps/api-gateway/package.json ./package.json
43+
3944
COPY --chown=node:node --from=sourcer $DIR/apps/api-gateway/dist ./dist
4045
COPY --chown=node:node --from=sourcer $DIR/node_modules $DIR/node_modules
4146
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
@@ -46,4 +51,4 @@ EXPOSE 3000
4651
FROM production AS patched
4752
USER root
4853
RUN apk -U upgrade
49-
USER node
54+
USER node

apps/api-gateway/src/auth/interfaces/user.session.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Request } from "express";
33
export enum UserRole {
44
LEARNER = "learner",
55
AUTHOR = "author",
6+
ADMIN = "admin",
67
}
78

89
export interface UserSession {

apps/api-gateway/src/main.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import instana from "@instana/collector";
12
import { VersioningType } from "@nestjs/common";
23
import { NestFactory } from "@nestjs/core";
34
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
45
import * as cookieParser from "cookie-parser";
6+
import { json, urlencoded } from "express";
57
import helmet from "helmet";
68
import { WinstonModule } from "nest-winston";
79
import { AppModule } from "./app.module";
810
import { winstonOptions } from "./logger/config";
9-
import instana from "@instana/collector";
1011

1112
instana();
1213

@@ -15,7 +16,8 @@ async function bootstrap() {
1516
cors: false,
1617
logger: WinstonModule.createLogger(winstonOptions),
1718
});
18-
19+
app.use(json({ limit: "1000mb" }));
20+
app.use(urlencoded({ limit: "1000mb", extended: true }));
1921
app.setGlobalPrefix("api", {
2022
exclude: ["health", "health/liveness", "health/readiness"],
2123
});

apps/api/.eslintrc.cjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ module.exports = {
1616
],
1717
rules: {
1818
"unicorn/prefer-top-level-await": "off",
19-
'unicorn/no-nested-ternary': 'off',
19+
"unicorn/no-nested-ternary": "off",
20+
"unicorn/no-null": "off",
21+
"@typescript-eslint/no-explicit-any": "off",
22+
"@typescript-eslint/require-await": "off",
2023
"unicorn/no-abusive-eslint-disable": "off",
2124
"unicorn/prevent-abbreviations": [
2225
"error",

apps/api/Dockerfile

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,58 @@
1-
# local-test/api.Dockerfile
21
# Using a consistent base for all stages
32
ARG BASE_IMAGE=node:22-alpine
4-
FROM node:22-alpine AS builder
3+
# hadolint ignore=DL3006
4+
FROM ${BASE_IMAGE} AS builder
55

66
ARG DIR=/usr/src/app
77

8-
# Pruning using turbo
8+
# Copy package files for dependency resolution
99
WORKDIR $DIR
1010
COPY . .
1111
RUN yarn global add turbo@^2.0.3
1212
RUN turbo prune api --docker && rm -f .npmrc
1313

1414
# Installing the isolated workspace
15-
FROM node:22-alpine AS installer
15+
# hadolint ignore=DL3006
16+
FROM ${BASE_IMAGE} AS installer
1617
ARG DIR=/usr/src/app
1718
WORKDIR $DIR
1819
COPY --from=builder $DIR/out/json/ .
1920
COPY --from=builder $DIR/out/yarn.lock ./yarn.lock
2021
COPY --from=builder $DIR/turbo.json ./turbo.json
2122
COPY --from=builder $DIR/packages ./packages
2223
COPY --from=builder $DIR/apps/api/prisma ./prisma
23-
RUN yarn install --ignore-scripts --frozen-lockfile --network-timeout 600000
24+
# Install build dependencies (including pkgconf) and rebuild native modules
2425
RUN apk add --no-cache python3~=3 make~=4 g++~=14 pkgconf~=2 \
26+
&& yarn install --frozen-lockfile \
2527
&& yarn prisma generate \
2628
&& npm rebuild cld --build-from-source
29+
2730
# Running build using turbo
28-
FROM node:22-alpine AS sourcer
31+
# hadolint ignore=DL3006
32+
FROM ${BASE_IMAGE} AS sourcer
2933
ARG DIR=/usr/src/app
3034
WORKDIR $DIR
3135
COPY --from=installer $DIR/ .
3236
COPY --from=builder $DIR/out/full/ .
3337
COPY --from=builder /usr/local/share/.config/yarn/global /usr/local/share/.config/yarn/global
34-
WORKDIR $DIR/apps/api
35-
RUN npx prisma generate
36-
WORKDIR $DIR
37-
RUN yarn build --filter=api && yarn install --production --ignore-scripts --frozen-lockfile --network-timeout 600000
38+
RUN yarn build --filter=api && yarn install --production --ignore-scripts --frozen-lockfile
3839

3940
# Production stage
40-
FROM node:22-alpine AS production
41-
ARG DIR=/usr/src/app
41+
# hadolint ignore=DL3006
42+
FROM ${BASE_IMAGE} AS production
4243
ENV NODE_ENV production
44+
ARG DIR=/usr/src/app
4345
WORKDIR $DIR
44-
RUN apk add --no-cache dumb-init=1.2.5-r3
46+
RUN apk add --no-cache dumb-init~=1 postgresql15-client~=15
4547
COPY --chown=node:node --from=sourcer $DIR/apps/api/package.json ./package.json
4648
COPY --chown=node:node --from=sourcer $DIR/apps/api/dist ./dist
4749
COPY --chown=node:node --from=sourcer $DIR/node_modules $DIR/node_modules
4850
COPY --chown=node:node --from=sourcer $DIR/prisma ./prisma
4951
COPY --chown=node:node --from=sourcer $DIR/apps/api/migrate.sh ./migrate.sh
5052
COPY --chown=node:node --from=sourcer $DIR/apps/api/ensureDb.js ./ensureDb.js
53+
COPY --chown=node:node --from=sourcer $DIR/apps/api/src/scripts ./scripts
5154
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
52-
CMD ["node", "dist/main.js"]
55+
CMD ["node", "dist/src/main.js"]
5356
EXPOSE 3000
5457

5558
# Patched stage with updates

0 commit comments

Comments
 (0)