-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (21 loc) · 851 Bytes
/
Dockerfile
File metadata and controls
29 lines (21 loc) · 851 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
FROM public.ecr.aws/docker/library/node:18 AS base
WORKDIR /usr/src/app
COPY . .
ENV NODE_OPTIONS="--max-old-space-size=4096"
ARG BUILD_TYPE=prod
RUN npm i
RUN if [ "$BUILD_TYPE" = "embeddedapp" ]; then npm run build:embeddedapp; else npm run build:prod; fi
FROM public.ecr.aws/docker/library/node:18-alpine
WORKDIR /usr/src/app
COPY --from=base /usr/src/app/dist /usr/src/app/dist
COPY --from=base /usr/src/app/package*.json ./
# Update Alpine package manager and upgrade openssl libcrypto3 libssl3
RUN apk upgrade --no-cache openssl libcrypto3 libssl3 \
&& apk add --no-cache bash
# Create non-root user and switch to it
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Give ownership of /usr/src/app to appuser
RUN chown -R appuser:appgroup /usr/src/app
USER appuser
EXPOSE 9000 9001
CMD [ "/bin/bash", "-c", "npm run serve" ]