forked from restackio/examples-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (27 loc) · 806 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
42
43
44
# ------- Image ----------
FROM node:20-bullseye-slim AS installer
RUN apt-get update \
&& apt-get install -y ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY ./package.json ./app/package.json
COPY ./tsconfig.json ./app/tsconfig.json
WORKDIR /app
RUN npm install
# ------- Builder ----------
FROM node:20-bullseye-slim AS builder
WORKDIR /app
COPY --from=installer /app .
COPY ./src ./src
RUN npm run build
# ------- Runner ----------
FROM node:20-bullseye-slim AS runner
RUN apt-get update \
&& apt-get install -y ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN addgroup --system --gid 1001 service
RUN adduser --system --uid 1001 service
USER service
WORKDIR /app
COPY --from=builder /app .
ENV NODE_OPTIONS=”--max-old-space-size=4096″
CMD ["node", "dist/services"]