Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -8
Dockerfile
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
-
# Gunakan
|
2 |
FROM node:18-alpine
|
3 |
|
|
|
|
|
|
|
4 |
# Buat user non-root
|
5 |
RUN adduser -D user
|
6 |
USER user
|
@@ -8,20 +11,17 @@ USER user
|
|
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 7860
|
24 |
EXPOSE 7860
|
25 |
|
26 |
-
# Jalankan Next.js di port 7860
|
27 |
CMD ["pnpm", "start", "--", "-p", "7860", "-H", "0.0.0.0"]
|
|
|
1 |
+
# Gunakan Node.js 18 Alpine sebagai base image
|
2 |
FROM node:18-alpine
|
3 |
|
4 |
+
# Install pnpm secara global
|
5 |
+
RUN corepack enable && corepack prepare pnpm@latest --activate
|
6 |
+
|
7 |
# Buat user non-root
|
8 |
RUN adduser -D user
|
9 |
USER user
|
|
|
11 |
# Set working directory
|
12 |
WORKDIR /app
|
13 |
|
14 |
+
# Copy semua file ke dalam container
|
15 |
COPY --chown=user:user . .
|
16 |
|
17 |
+
# Install dependencies dengan pnpm
|
|
|
|
|
|
|
18 |
RUN pnpm install --frozen-lockfile
|
19 |
|
20 |
# Build aplikasi Next.js
|
21 |
RUN pnpm build
|
22 |
|
23 |
+
# Expose port 7860 agar bisa diakses dari luar container
|
24 |
EXPOSE 7860
|
25 |
|
26 |
+
# Jalankan Next.js di port 7860 dan host 0.0.0.0
|
27 |
CMD ["pnpm", "start", "--", "-p", "7860", "-H", "0.0.0.0"]
|