Files
dlearn-admin/Dockerfile
T
morteza ae180d22d6
deploy to danak / build_and_deploy (push) Has been cancelled
opt dckr
2026-06-25 19:14:48 +03:30

33 lines
843 B
Docker

# -------- Build Stage --------
FROM node:20-alpine AS builder
WORKDIR /app
# Copy only dependency files first (better cache)
COPY package*.json ./
# Use clean install for reproducible builds
RUN npm ci
# Copy source after deps (maximizes cache usage)
COPY . .
# Build with production mode
RUN npm run build
# -------- Production Stage --------
FROM nginx:stable-alpine AS production
# Copy built assets
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy nginx config (optional, safer naming)
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Remove default nginx config if needed (optional safety)
RUN rm -f /etc/nginx/conf.d/default.conf.default || true
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]