fixing dockerfile

This commit is contained in:
rheiga19 2025-03-26 22:42:17 +07:00
parent 28fa62a30e
commit 193bb427d2
1 changed files with 11 additions and 7 deletions

View File

@ -3,23 +3,27 @@ FROM node:20-alpine as build
WORKDIR /app
# Copy package files and install dependencies
COPY package.json package-lock.json* ./
RUN npm ci
# Tambahkan dependensi yang mungkin dibutuhkan
RUN apk add --no-cache python3 make g++ git
# Copy the rest of the application code
# Copy package files dan install dependencies
COPY package.json package-lock.json* ./
# Gunakan --legacy-peer-deps untuk mengatasi masalah kompatibilitas
RUN npm ci --legacy-peer-deps || npm install --legacy-peer-deps
# Copy kode aplikasi
COPY . .
# Build the application
# Build aplikasi
RUN npm run build
# Production stage
FROM nginx:alpine
# Copy the built files from the build stage to nginx
# Copy file hasil build ke nginx
COPY --from=build /app/dist /usr/share/nginx/html
# Create a custom nginx configuration that handles SPA routing
# Buat konfigurasi nginx untuk SPA routing
RUN echo 'server { \
listen 80; \
server_name _; \