Skip to content

Commit d92f6b6

Browse files
committed
chore: update Dockerfile and package versions to 1.1.1, add OpenSSL dependencies, and adjust Prisma client configuration
1 parent 941d02c commit d92f6b6

File tree

5 files changed

+28
-21
lines changed

5 files changed

+28
-21
lines changed

backend/Dockerfile

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
FROM node:22-slim AS base
55
WORKDIR /app
66

7-
# Install dependencies system (buat Prisma & NestJS build)
7+
# Install system deps (Prisma & build)
88
RUN apt-get update && apt-get install -y \
99
bash \
1010
git \
@@ -13,6 +13,8 @@ RUN apt-get update && apt-get install -y \
1313
g++ \
1414
libc6-dev \
1515
dumb-init \
16+
openssl \
17+
libssl-dev \
1618
&& rm -rf /var/lib/apt/lists/*
1719

1820
# Update npm versi terbaru
@@ -21,24 +23,20 @@ RUN npm install -g npm@11
2123
# Salin dependency info lebih dulu
2224
COPY package*.json ./
2325

24-
# Install dependencies (gunakan npm install, bukan ci agar fleksibel di dev)
26+
# Install dependencies (flexible for dev)
2527
RUN npm install --legacy-peer-deps
2628

27-
# Generate Prisma client lebih cepat (kalau schema belum ada, skip tanpa error)
28-
COPY prisma ./prisma
29-
RUN npx prisma generate || echo "Skip prisma generate (schema belum ada)"
29+
# (JANGAN generate Prisma di sini — kita akan generate di builder setelah copy seluruh schema & source)
3030

3131
# =======================
3232
# STAGE 2: DEVELOPMENT
3333
# =======================
3434
FROM base AS development
3535
ENV NODE_ENV=development
36-
# Disable file watching performance warning
3736
ENV WATCHPACK_POLLING=true
3837
ENV CHOKIDAR_USEPOLLING=true
3938
ENV CHOKIDAR_INTERVAL=500
4039

41-
4240
WORKDIR /app
4341

4442
# Copy semua source (untuk container dev yang standalone)
@@ -47,41 +45,49 @@ COPY . .
4745
# Expose port NestJS dev server
4846
EXPOSE 3000
4947

50-
# Gunakan dumb-init agar proses clean shutdown
5148
ENTRYPOINT ["dumb-init", "--"]
52-
53-
# Jalankan NestJS dev mode (watch mode)
5449
CMD ["npm", "run", "start:dev"]
5550

5651
# =======================
5752
# STAGE 3: BUILD (Production)
5853
# =======================
5954
FROM base AS builder
6055
WORKDIR /app
56+
57+
# Copy source to builder (schemas, src, tsconfig, dll.)
6158
COPY . .
6259

60+
# Generate Prisma client inside builder (ensures binaries match this environment)
61+
RUN npx prisma generate
62+
6363
# Build NestJS (kompilasi ke dist)
6464
RUN npm run build
6565

66+
# Optional: remove dev deps to slim node_modules if you want
67+
# RUN npm prune --production
68+
6669
# =======================
6770
# STAGE 4: PRODUCTION
6871
# =======================
6972
FROM node:22-slim AS production
7073
WORKDIR /app
7174

72-
# Install minimal runtime deps
73-
RUN apt-get update && apt-get install -y dumb-init && rm -rf /var/lib/apt/lists/*
75+
# Install minimal runtime deps including openssl
76+
RUN apt-get update && apt-get install -y \
77+
dumb-init \
78+
openssl \
79+
&& rm -rf /var/lib/apt/lists/*
80+
7481
ENV TZ=Asia/Jakarta
7582
ENV NODE_ENV=production
7683

77-
# Copy hasil build dan dependensi
84+
# Copy hasil build dan dependensi dari builder
7885
COPY --from=builder /app/dist ./dist
79-
COPY --from=base /app/node_modules ./node_modules
80-
COPY --from=builder /app/package*.json ./
86+
COPY --from=builder /app/node_modules ./node_modules
87+
COPY --from=builder /app/package*.json ./
8188
COPY --from=builder /app/prisma ./prisma
8289
COPY --from=builder /app/public ./public
8390

84-
# Expose port aplikasi
8591
EXPOSE 3000
8692

8793
ENTRYPOINT ["dumb-init", "--"]

backend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "commitflow-api",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Backend CommitFlow",
55
"author": "asepindrak",
66
"private": false,

backend/prisma/schema.prisma

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
66

77
generator client {
8-
provider = "prisma-client-js"
8+
provider = "prisma-client-js"
9+
binaryTargets = ["native", "debian-openssl-1.1.x", "debian-openssl-3.0.x"]
910
}
1011

1112
datasource db {

backend/src/app.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { Injectable } from "@nestjs/common";
33
@Injectable()
44
export class AppService {
55
getHello(): string {
6-
return `CommitFlow API (1.1.0) is running!`;
6+
return `CommitFlow API (1.1.1) is running!`;
77
}
88
}

0 commit comments

Comments
 (0)