Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronenii authored Jul 31, 2024
1 parent f3dba52 commit 8aa2033
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,13 @@
# Use official Node.js image as the base image
FROM node:20-slim AS build
FROM node:20-slim

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./
COPY package.json .

# Install dependencies
RUN npm install
RUN npm i

# Copy the rest of the application
COPY . .

# Build the application using TypeScript and Vite
RUN npm run build

# Use a smaller base image for the final stage
FROM node:20-alpine

# Set the working directory
WORKDIR /app

# Copy only the necessary files for the final image
COPY --from=build /app/package*.json ./
COPY --from=build /app/dist /app/dist

# Install only production dependencies
RUN npm install --production

# Expose the application port
EXPOSE 8080

# Command to run the application
CMD ["npm", "run", "preview"]
CMD [ "npm", "run", "dev" ]

0 comments on commit 8aa2033

Please sign in to comment.