-
Notifications
You must be signed in to change notification settings - Fork 576
Expand file tree
/
Copy pathDockerfile_ui
More file actions
47 lines (32 loc) · 1.1 KB
/
Dockerfile_ui
File metadata and controls
47 lines (32 loc) · 1.1 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
44
45
46
47
# syntax=docker/dockerfile:1.7
########### Builder: compile Vite/TypeScript/etc. ###########
FROM node:22-alpine AS builder
WORKDIR /app
# Install ALL dependencies (including devDeps) — required for Vite, tsc, plugins, etc.
COPY ui/package.json ui/package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \
npm ci
# Copy source (node_modules should be excluded via .dockerignore)
COPY ui/ ./
# Build the app
RUN --mount=type=cache,target=/root/.npm \
npm run build
########### Runtime: minimal production image ###########
FROM node:22-alpine AS runner
ARG COMMIT_SHA
WORKDIR /app
# Set env before install so some libs can optimize for production
ENV NODE_ENV=production
ENV PORT=3030
ENV HOST=0.0.0.0
ENV COMMIT_SHA=${COMMIT_SHA}
# Install only production deps
COPY ui/package.json ui/package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \
npm ci --omit=dev
# Bring in built assets and server entry from builder
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/server-start.js ./
COPY --from=builder /app/request-logging.js ./
EXPOSE 3030
CMD ["node", "server-start.js"]