26 lines
670 B
Docker
26 lines
670 B
Docker
# Stage 1: Build the Vite application
|
|
FROM node:20-alpine as build
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and package-lock.json (if present) to leverage Docker cache
|
|
COPY package.json package-lock.json* ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy the rest of the application code
|
|
COPY . .
|
|
|
|
# Build the Vite application for production
|
|
# You might need to adjust 'npm run build' if your build script is different
|
|
RUN npm run build
|
|
|
|
# Stage 2: Serve the built application with Nginx
|
|
FROM nginx:latest
|
|
|
|
# Copy the built Vite application from the build stage to Nginx's web root
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
# Expose port 80 for web traffic
|
|
EXPOSE 80 |