-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (31 loc) · 964 Bytes
/
Copy pathDockerfile
File metadata and controls
40 lines (31 loc) · 964 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
FROM node:20-alpine AS build
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
COPY --chown=node:node . .
RUN yarn install --frozen-lockfile
RUN yarn build
USER node
FROM public.ecr.aws/amazonlinux/amazonlinux:2023
# We tell DNF not to install Recommends and Suggests packages, which are
# weak dependencies in DNF terminology, thus keeping our installed set of
# packages as minimal as possible.
RUN dnf --setopt=install_weak_deps=False install -q -y \
nodejs20 \
shadow-utils \
&& \
dnf clean all
RUN alternatives --install /usr/bin/node node /usr/bin/node-20 90
ENV APPUSER=appuser
ENV APPUID=1000
ENV APPGID=1000
RUN useradd \
--home "/app" \
--create-home \
--user-group \
--uid "$APPUID" \
"$APPUSER"
WORKDIR /app
USER appuser
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/app/dist ./dist
ENTRYPOINT [ "node", "dist/main.js" ]