Files
simrsx-fe/Dockerfile
2025-12-11 10:11:58 +07:00

34 lines
913 B
Docker

# Build Stage
FROM node:20-alpine AS build-stage
# Set the working directory inside the container
WORKDIR /app
# Enable pnpm using corepack
RUN corepack enable
# Copy pnpm related files and package.json to leverage Docker layer caching
COPY package.json pnpm-lock.yaml ./
# Install dependencies using pnpm
# Using --frozen-lockfile ensures consistent installations based on pnpm-lock.yaml
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store pnpm install --frozen-lockfile
# Copy the rest of the application files
COPY . .
# Build the Vue.js application for production
RUN pnpm build
# Production Stage
FROM nginx:stable-alpine AS production-stage
# Copy the built Vue.js application from the build stage to Nginx's web root
COPY --from=build-stage /app/dist /usr/share/nginx/html
# Expose port 80 for Nginx
EXPOSE 80
# Command to run Nginx in the foreground
CMD ["nginx", "-g", "daemon off;"]