Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- 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 |
-
#
|
12 |
-
|
13 |
-
RUN chmod -R 777 /app
|
14 |
|
15 |
-
|
|
|
16 |
|
17 |
# Install dependencies
|
18 |
-
RUN pnpm install
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
# Jalankan
|
21 |
-
CMD ["pnpm", "
|
|
|
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"]
|