try to depoly
This commit is contained in:
31
Dockerfile
31
Dockerfile
@@ -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" ]
|
Reference in New Issue
Block a user