Files
mbmanager-dashboard/Dockerfile
T
kavehhn 9d16b90e18
deploy-chabokan / deploy (push) Canceled after 0s
build(docker): use liara npm mirror registry
2026-08-30 09:42:14 +03:30

45 lines
1018 B
Docker

# Stage 1: Build the Vue SPA application
FROM node:20-alpine AS builder
WORKDIR /app
# Copy dependency definitions
COPY package*.json ./
# Configure Liara npm mirror registry
RUN npm config set registry https://package-mirror.liara.ir/repository/npm/ --global
# Install all dependencies (including devDependencies required for Vite build)
RUN npm ci
# Pass build arguments for environment variables
ARG VITE_API_URL=""
ARG VITE_ENV=production
ENV VITE_API_URL=$VITE_API_URL
ENV VITE_ENV=$VITE_ENV
# Copy application source files
COPY . .
# Build production static bundle
RUN npm run build
# Stage 2: Serve application with Nginx
FROM nginx:alpine AS runner
# Remove default nginx static assets
RUN rm -rf /usr/share/nginx/html/*
# Copy custom nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy compiled assets from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
# Expose web server port
EXPOSE 80
# Run nginx in foreground
CMD ["nginx", "-g", "daemon off;"]