-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (21 loc) · 694 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (21 loc) · 694 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
# Build the code.
FROM node:lts-alpine AS builder
WORKDIR /srv/www
COPY package.json package-lock.json ./
# Install ALL dependencies (dev + prod)
RUN npm ci
# Copy source code
COPY . .
# Build the application
RUN npm run prepublishOnly
# Prune dev dependencies after build to reduce image size
RUN npm prune --omit=dev
# Create the final image
FROM node:lts-alpine
WORKDIR /srv/www/dist
# Copy only the necessary files from the builder
COPY --from=builder /srv/www/dist /srv/www/dist/
COPY --from=builder /srv/www/node_modules /srv/www/node_modules/
COPY --from=builder /srv/www/static /srv/www/static/
COPY --from=builder /srv/www/package.json /srv/www/package.json
CMD [ "cli.js" ]