This commit is contained in:
Irwan Cahyono 2025-07-01 09:29:58 +07:00
parent 33fc02acfb
commit 1538038c05
2 changed files with 41 additions and 0 deletions

30
Dockerfile Normal file
View File

@ -0,0 +1,30 @@
# Tahap build
FROM node:24-alpine AS builder
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm install
# Copy semua source code
COPY . .
# Build project Nuxt
RUN npm run build
# Tahap production
FROM node:24-alpine AS runner
WORKDIR /app
# Salin hanya file yang dibutuhkan untuk production
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package*.json ./
# Nuxt 3 menjalankan server dari .output/server/index.mjs
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]
#CMD ["npm", "run", "dev"]

11
docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
services:
nuxt-app:
build: .
container_name: nuxt-container
ports:
- "3000:3000"
environment:
- NODE_ENV=production
volumes:
- .:/app
restart: unless-stopped