update dockerfile

This commit is contained in:
rheiga19 2025-03-26 23:24:01 +07:00
parent a8d825c573
commit c590466247
1 changed files with 12 additions and 9 deletions

View File

@ -13,16 +13,19 @@ RUN npm install
COPY . . COPY . .
# Build the project # Build the project
RUN npm run build RUN npm run start
# Use Nginx for serving static files # Final stage
FROM nginx:alpine FROM node:18-alpine
# Copy build files to Nginx html directory # Set working directory
COPY --from=builder /app/dist /usr/share/nginx/html WORKDIR /app
# Expose port 80 # Copy built files from builder
EXPOSE 80 COPY --from=builder /app ./
# Start Nginx # Expose the application port (sesuaikan dengan port yang digunakan di package.json)
CMD ["nginx", "-g", "daemon off;"] EXPOSE 4173
# Jalankan aplikasi dengan npm run preview
CMD ["npm", "run", "preview"]