-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (25 loc) · 777 Bytes
/
Dockerfile
File metadata and controls
36 lines (25 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Dockerfile
# Use the official Node.js image (LTS version)
FROM node:18-alpine AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy package.json and package-lock.json (if it exists)
COPY package.json package-lock.json* ./
# Install dependencies
RUN npm install
# Copy the entire source code
COPY . .
# Build the application for production
RUN npm run build
# Production stage
FROM node:18-alpine
# Set the working directory
WORKDIR /app
# Install serve globally to run the built application
RUN npm install -g serve
# Copy the dist folder from the builder stage
COPY --from=builder /app/dist ./dist
# Expose port 3000 (the port Vite has been configured to use)
EXPOSE 3000
# Start the application
CMD ["serve", "-s", "dist", "-l", "3000"]