update dockerfile frontend for gitops

This commit is contained in:
Syifa 2025-10-22 13:03:27 +07:00
parent 55b8ceb5ba
commit 69d55ddc6a
1 changed files with 8 additions and 4 deletions

View File

@ -1,19 +1,23 @@
FROM node:18-alpine FROM node:18-alpine
# Set working directory
WORKDIR /app WORKDIR /app
# Copy package files & install deps # Copy package.json & package-lock.json (kalau ada)
COPY package*.json ./ COPY package*.json ./
RUN npm ci --only=production
# Install dependencies production-only
RUN npm install --only=production
# Copy source code # Copy source code
COPY . . COPY . .
# 🔒 non-root user (aman di Kubernetes) # Ubah kepemilikan agar aman di Kubernetes
RUN chown -R node:node /app RUN chown -R node:node /app
USER node USER node
# Expose port 3000
EXPOSE 3000 EXPOSE 3000
# Jalankan React dev server / Express tergantung project kamu # Jalankan app
CMD ["npm", "start"] CMD ["npm", "start"]