-
Notifications
You must be signed in to change notification settings - Fork 0
/
Imagefile
44 lines (27 loc) · 1.02 KB
/
Imagefile
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
# -------------> Generate SSL certificates
FROM nginx:latest AS certBuilder
WORKDIR /usr/certs
RUN openssl req -x509 -sha256 -nodes -days 365 \
-newkey rsa:2048 -keyout private.key -out certificate.crt \
-subj "/C=NP/ST=state1/L=city1/O=Test/OU=Org43/CN=localhost/emailAddress=tets@localhost.com"
# -----------> Build Image
FROM node:latest AS BuildImage
RUN npm i -g pnpm
WORKDIR /usr/app
COPY package.json .
COPY pnpm-lock.yaml .
# RUN pnpm install --frozen-lockfile --prod
RUN pnpm install
# -------------> Production Image
# image@digest
FROM node:18-bullseye-slim@sha256:f3ecbc009558021098b634afe45ee6179aaa80a65501cd90dad65e0db9490af5 AS deploy
ENV NODE_ENV production
WORKDIR /usr/app
COPY --chown=node:node --from=certBuilder /usr/certs ./certs
COPY --chown=node:node --from=BuildImage /usr/app/node_modules ./node_modules
COPY --chown=node:node tsconfig.json .
COPY --chown=node:node package.json .
COPY --chown=node:node nodemon.json .
COPY --chown=node:node ./src ./src
USER node
CMD ["npm" ,"run", "serve:dev"]