-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (23 loc) · 801 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
################################################## 1
FROM node:18.16.0-alpine AS dependencies
LABEL maintainer="Pavel Belokon <[email protected]>"
LABEL description="Fragments node.js microservice"
ENV NODE_ENV=production
ENV PORT=1234
WORKDIR /app
COPY package.json package-lock.json ./
# only install production dependencies
RUN npm ci --only=production
################################################## 2
FROM node:18.16.0-alpine AS builder
# Use /app as our working directory
WORKDIR /app
COPY --from=dependencies /app /app
COPY . .
ENV NPM_CONFIG_LOGLEVEL=warn
ENV NPM_CONFIG_COLOR=false
CMD ["npm", "run", "build"]
################################################## 3
FROM nginx:stable-alpine AS deploy
COPY --from=builder /app/dist/ /usr/share/nginx/html/
EXPOSE 80