update docker

This commit is contained in:
Irwan Cahyono 2025-07-01 10:20:26 +07:00
parent 973419c093
commit 8da2c2da5f
2 changed files with 11 additions and 8 deletions

View File

@ -7,10 +7,10 @@ WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm install --legacy-peer-deps RUN npm install --legacy-peer-deps
# Copy semua source code # Salin semua source code
COPY . . COPY . .
# Build project Nuxt # Build project Nuxt 3
RUN npm run build RUN npm run build
# Tahap production # Tahap production
@ -18,13 +18,18 @@ FROM node:24-alpine AS runner
WORKDIR /app WORKDIR /app
# Salin hanya file yang dibutuhkan untuk production # NODE_ENV untuk optimasi dependency
ENV NODE_ENV=production
# Salin hanya file penting untuk runtime
COPY --from=builder /app/.output ./.output COPY --from=builder /app/.output ./.output
COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package*.json ./ COPY --from=builder /app/package.json ./package.json
# Pastikan ini file ada
RUN test -f .output/server/index.mjs
# Nuxt 3 menjalankan server dari .output/server/index.mjs
EXPOSE 3000 EXPOSE 3000
# Jalankan Nuxt 3 SSR
CMD ["node", ".output/server/index.mjs"] CMD ["node", ".output/server/index.mjs"]
#CMD ["npm", "run", "dev"]

View File

@ -6,6 +6,4 @@ services:
- "3000:3000" - "3000:3000"
environment: environment:
- NODE_ENV=production - NODE_ENV=production
volumes:
- .:/app
restart: unless-stopped restart: unless-stopped