galihrhgnwn commited on
Commit
c0aefb9
·
verified ·
1 Parent(s): 9ff7ceb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -11
Dockerfile CHANGED
@@ -1,21 +1,27 @@
 
1
  FROM node:18-alpine
2
 
3
- # Install pnpm
4
- RUN npm install -g pnpm
5
-
6
  # Buat user non-root
7
  RUN adduser -D user
 
 
 
8
  WORKDIR /app
9
- COPY . /app
10
 
11
- # Ubah kepemilikan dan izin file
12
- RUN chown -R user:user /app
13
- RUN chmod -R 777 /app
14
 
15
- USER user
 
16
 
17
  # Install dependencies
18
- RUN pnpm install
 
 
 
 
 
 
19
 
20
- # Jalankan aplikasi
21
- CMD ["pnpm", "dev"]
 
1
+ # Gunakan image Node.js terbaru dengan Alpine (ringan)
2
  FROM node:18-alpine
3
 
 
 
 
4
  # Buat user non-root
5
  RUN adduser -D user
6
+ USER user
7
+
8
+ # Set working directory
9
  WORKDIR /app
 
10
 
11
+ # Copy semua file ke container
12
+ COPY --chown=user:user . .
 
13
 
14
+ # Install pnpm
15
+ RUN corepack enable && corepack prepare pnpm@latest --activate
16
 
17
  # Install dependencies
18
+ RUN pnpm install --frozen-lockfile
19
+
20
+ # Build aplikasi Next.js
21
+ RUN pnpm build
22
+
23
+ # Expose port 3000 (default Next.js)
24
+ EXPOSE 3000
25
 
26
+ # Jalankan Next.js
27
+ CMD ["pnpm", "start"]