-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (26 loc) · 1.2 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (26 loc) · 1.2 KB
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
# ─── Stage 1: Development ────────────────────────────────────────────────────
FROM node:20-alpine AS dev
WORKDIR /app
RUN apk add --no-cache bash
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 5173
CMD ["npm", "run", "dev", "--", "--host"]
# ─── Stage 2: Build ──────────────────────────────────────────────────────────
FROM node:20-alpine AS builder
WORKDIR /app
RUN apk add --no-cache bash
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
RUN mkdir -p /app/dist-final/lights-out && \
cp -r /app/dist/. /app/dist-final/lights-out/ && \
cp /app/dist/index.html /app/dist-final/index.html
# ─── Stage 3: Production ─────────────────────────────────────────────────────
FROM nginx:alpine AS prod
COPY --from=builder /app/dist-final /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]