-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern.Dockerfile
More file actions
43 lines (30 loc) · 937 Bytes
/
pattern.Dockerfile
File metadata and controls
43 lines (30 loc) · 937 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
33
34
35
36
37
38
39
40
41
42
43
# Build container
FROM node:lts-alpine as builder
WORKDIR /usr/src/app
## Install dependencies
COPY package*.json ./
RUN apk add --no-cache --virtual .deps g++ make python && npm ci --quiet && apk del .deps
## Copy source
COPY ./src src
COPY tsconfig.json .
## Build
RUN npm run build
# ----------------
# Runtime container
FROM node:lts-alpine
ENV NODE_ENV=production
WORKDIR /app
## Install runtime dependencies
COPY package*.json ./
RUN apk add --no-cache --virtual .deps g++ make python && npm ci --quiet --production && apk del .deps
## Copy build output from previous stage
COPY --from=builder /usr/src/app/dist dist
## Create user that will run the app
RUN addgroup -S iotcrawler
RUN adduser -S -D -g '' -H patternExtractor iotcrawler
RUN chown -R patternExtractor:iotcrawler .
## Make sure we are not running as root
USER patternExtractor:iotcrawler
## Start the App
CMD ["node", "dist/index.js"]
# ----------------