forked from open-amt-cloud-toolkit/mps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (34 loc) · 1.34 KB
/
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
43
#*********************************************************************
# Copyright (c) Intel Corporation 2021
# SPDX-License-Identifier: Apache-2.0
#*********************************************************************/
#Multistage docker layer to isolate the git credentials
#First stage copy and install dependencies
FROM node:20-bullseye-slim@sha256:9cb48d12eeccb9e6ad25e987dda1077399cd63877a46e9e848273c44690ca175 as builder
WORKDIR /mps
COPY package*.json ./
# Install dependencies
RUN npm ci --unsafe-perm
COPY tsconfig.json tsconfig.build.json ./
COPY src ./src/
COPY agent ./agent/
COPY .mpsrc ./
# Transpile TS -> JS
RUN npm run build
RUN npm prune --production
FROM alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b
LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) Intel Corporation 2021'
RUN addgroup -g 1000 node && adduser -u 1000 -G node -s /bin/sh -D node
RUN apk update && apk upgrade --no-cache && apk add nodejs --no-cache
COPY --from=builder /mps/dist /mps/dist
# for healthcheck backwards compatibility
COPY --from=builder /mps/.mpsrc /.mpsrc
COPY --from=builder /mps/node_modules /mps/node_modules
COPY --from=builder /mps/package.json /mps/package.json
# set the user to non-root
USER node
# Default Ports Used
EXPOSE 4433
EXPOSE 3000
CMD ["node", "/mps/dist/index.js"]