-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerFile
44 lines (30 loc) · 928 Bytes
/
DockerFile
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
37
38
39
40
41
42
43
44
# Stage 1: Build Stage
FROM node:18 AS builder
# Set the working directory
WORKDIR /app
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# Install pnpm globally
RUN npm install -g pnpm
# Install all dependencies (including devDependencies)
RUN pnpm install
# Copy the rest of the application code
COPY . .
# Build the production-ready files
RUN pnpm run build
# Stage 2: Serve Stage
FROM node:18
# Set the working directory
WORKDIR /app
# Install pnpm globally
RUN npm install -g pnpm
# Copy build files from the builder stage
COPY --from=builder /app/dist ./dist
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# Install dependencies (including devDependencies for `vite preview`)
RUN pnpm install --frozen-lockfile
# Expose port 3000
EXPOSE 3000
# Command to start the Vite preview server
CMD ["pnpm", "run", "preview", "--host", "0.0.0.0", "--port", "3000"]