-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
36 lines (26 loc) · 818 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
# syntax = docker/dockerfile:1.2
FROM node:18.13.0-slim AS base
RUN apt-get update && apt-get install -y \
ca-certificates \
git \
&& rm -rf /var/lib/apt/lists/*
FROM base AS build
WORKDIR /src
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/src/node_modules \
npm install \
&& cp -r node_modules node_modules.bak
RUN rm -rf node_modules && mv node_modules.bak node_modules
COPY . .
RUN npm run build
ENV NODE_EXTRA_CA_CERTS=/src/config/upstream-transport/ca.crt
ENTRYPOINT [ "./docker-entrypoint.sh" ]
CMD [ "npm", "run", "server-dev" ]
FROM build AS pruned
RUN npm prune --production
FROM base AS final
WORKDIR /src
COPY --from=pruned /src .
ENV NODE_EXTRA_CA_CERTS=/src/config/upstream-transport/ca.crt \
NODE_ENV=production
ENTRYPOINT [ "./docker-entrypoint.sh" ]