-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (28 loc) · 988 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
# Specify platform to be amd because arm doesn't work
FROM --platform=linux/amd64 node:20-alpine as builder
RUN apk upgrade --no-cache
WORKDIR /app
# Copy app source
COPY package.json tsconfig.json yarn.lock ./
COPY src/ src/
RUN yarn install --frozen-lockfile
# Build the project.
RUN yarn run build
# prepare for production
RUN rm -R node_modules && \
yarn config set nmMode hardlinks-local && \
yarn install --production --frozen-lockfile
# Specify platform to be amd because arm doesn't work
FROM --platform=linux/amd64 alpine:3 as runner
ENV LOGGER=false
WORKDIR /app
RUN apk upgrade --no-cache && \
apk add --no-cache nodejs tini && \
addgroup -g 104 -S node && \
adduser -u 104 -D -S -G node node
# copy over minimal fileset to run availability-monitor
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json .
COPY --from=builder /app/build ./build
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "build/index.js"]