try to depoly

This commit is contained in:
2025-03-16 14:38:39 +08:00
parent ab9151d2c9
commit b42a69e70b
3 changed files with 20 additions and 26 deletions

View File

@@ -1,34 +1,17 @@
FROM node:18-alpine AS build
FROM node:18-alpine
WORKDIR /app
# Copy package files first for better layer caching
COPY package.json package-lock.json* ./
COPY package.json .
# Install dependencies
RUN npm ci
RUN npm install
RUN npm i -g serve
# Copy the rest of the application
COPY . .
# Build the application
RUN npm run build
# Production stage
FROM node:18-alpine AS production
EXPOSE 3000
WORKDIR /app
# Copy only the built assets and necessary files from the build stage
COPY --from=build /app/dist ./dist
COPY --from=build /app/package.json ./
# Expose the port Vite uses by default
EXPOSE 5173
# Use a static file server for production builds
RUN npm install -g serve
# Serve the built application
CMD ["serve", "-s", "dist", "-l", "5173"]
CMD [ "serve", "-s", "dist" ]