Skip to content

Commit 4d29b06

Browse files
authored
feat(backend)!: move from typeorm to prisma as ORM provider. (#1720)
1 parent 139eb17 commit 4d29b06

12 files changed

Lines changed: 659 additions & 652 deletions

backend/.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage/**
2+
dist/**
3+
node_modules/**

backend/Dockerfile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
# Build static files
22
# Node Bullseye has npm
3+
FROM node:20.10.0-bullseye-slim AS buildWithDevDeps
4+
5+
# Install packages, build and keep only prod packages
6+
WORKDIR /app
7+
COPY *.json ./
8+
COPY ./src ./src
9+
COPY ./prisma ./prisma
10+
RUN npm ci --ignore-scripts --no-update-notifier
11+
RUN npm run prisma-generate
312
FROM node:20.10.0-bullseye-slim AS build
413

514
# Install packages, build and keep only prod packages
615
WORKDIR /app
716
COPY *.json ./
817
COPY ./src ./src
9-
RUN npm ci --ignore-scripts --no-update-notifier --omit=dev && \
10-
npm run build
18+
COPY ./prisma ./prisma
19+
RUN npm ci --ignore-scripts --no-update-notifier --omit=dev
20+
21+
# COPY over few dependencies from buildWithDevDeps
22+
COPY --from=buildWithDevDeps /app/node_modules/@prisma ./node_modules/@prisma
23+
COPY --from=buildWithDevDeps /app/node_modules/.prisma ./node_modules/.prisma
24+
COPY --from=buildWithDevDeps /app/node_modules/prisma ./node_modules/prisma
25+
26+
RUN npm run build
1127

1228
# Deploy container
1329
# Distroless has node, but not npm
@@ -22,7 +38,7 @@ COPY --from=build /app/dist ./dist
2238
# Ports, health check and non-root user
2339
EXPOSE 3000
2440
HEALTHCHECK --interval=30s --timeout=3s CMD curl -f http://localhost/:3000/api || exit 1
25-
USER app
41+
USER nonroot
2642

2743
# Start up command with 50MB of heap size, each application needs to determine what is the best value. DONT use default as it is 4GB.
2844
CMD ["--max-old-space-size=50", "/app/dist/main"]

0 commit comments

Comments
 (0)