-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
46 lines (30 loc) · 938 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
45
46
FROM node:16-alpine AS base
WORKDIR /app
RUN addgroup -g 1001 animakuro && \
adduser -D -S -G animakuro animakuro && \
chown -R animakuro:animakuro /app && \
corepack enable pnpm
####################
FROM base as builder
RUN apk add --no-cache openssl openssl-dev libssl1.1 libssl3
USER animakuro
COPY package.json pnpm-lock.yaml ./
RUN pnpm fetch && \
pnpm i --offline --frozen-lockfile
COPY . .
ENV NODE_ENV=production
ARG service=api
RUN pnpm generate && \
pnpm build $service && \
pnpm prune --prod
####################
FROM base
ARG service=api
COPY --from=builder --chown=animakuro:animakuro /app/package.json /app/nest-cli.json ./
COPY --from=builder --chown=animakuro:animakuro /app/node_modules node_modules
COPY --from=builder --chown=animakuro:animakuro /app/dist/apps/$service dist
USER animakuro
ARG NODE_ENV
ENV NODE_ENV=${NODE_ENV:-production}
EXPOSE 8080
ENTRYPOINT pnpm start:prod