fixing dockerfile
This commit is contained in:
parent
28fa62a30e
commit
193bb427d2
|
|
@ -3,23 +3,27 @@ FROM node:20-alpine as build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package files and install dependencies
|
# Tambahkan dependensi yang mungkin dibutuhkan
|
||||||
COPY package.json package-lock.json* ./
|
RUN apk add --no-cache python3 make g++ git
|
||||||
RUN npm ci
|
|
||||||
|
|
||||||
# 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 . .
|
COPY . .
|
||||||
|
|
||||||
# Build the application
|
# Build aplikasi
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Production stage
|
# Production stage
|
||||||
FROM nginx:alpine
|
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
|
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 { \
|
RUN echo 'server { \
|
||||||
listen 80; \
|
listen 80; \
|
||||||
server_name _; \
|
server_name _; \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue