docker
This commit is contained in:
parent
33fc02acfb
commit
1538038c05
30
Dockerfile
Normal file
30
Dockerfile
Normal 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
11
docker-compose.yml
Normal 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
|
||||
Loading…
Reference in New Issue
Block a user