-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (27 loc) · 748 Bytes
/
Dockerfile
File metadata and controls
32 lines (27 loc) · 748 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
# Base Node Image
FROM node:14-alpine AS base
WORKDIR /app
RUN npm i -g node-prune
# Couchbase sdk requirements
RUN apk update && apk add bash
# Install dependencies
FROM base AS dependencies
COPY package*.json ./
RUN npm ci && npm cache clean --force
# Copy Files and Build
FROM dependencies AS build
WORKDIR /app
COPY . .
RUN npm run build
# Copy it and remove dev dependencies
FROM build AS prodDependencies
WORKDIR /app
COPY --from=dependencies /app/package*.json ./
COPY --from=dependencies /app/node_modules ./node_modules/
RUN npm prune --production && node-prune
FROM node:14-alpine
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY --from=prodDependencies /app/node_modules ./node_modules
EXPOSE 4000
CMD ["node", "./dist/main.js"]