-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (27 loc) · 919 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
# ---- Args ----
ARG NODE_VERSION="18.12.1"
ARG ALPINE_VERSION="3.17"
# ---- Base Node ----
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS base
WORKDIR /home/app
RUN apk add --no-cache curl && \
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm && chmod +x /bin/pnpm && \
apk del curl
COPY package.json pnpm-lock.yaml ./
RUN pnpm install
# ---- Build ----
FROM base AS build
COPY . .
RUN pnpm run typecheck
RUN pnpm run build
RUN pnpm prune --prod
# ---- Release ----
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION}
WORKDIR /home/node
COPY --from=build /home/app/node_modules ./node_modules/
COPY --from=build /home/app/package.json ./
COPY --from=build /home/app/dist ./dist/
COPY --from=build /home/app/src/sources ./dist/sources
COPY --from=build /home/app/src/openapi.yaml ./dist/openapi.yaml
EXPOSE 3000
ENTRYPOINT ["node", "dist/index.js"]