forked from GEWIS/sudosos-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (24 loc) · 994 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (24 loc) · 994 Bytes
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
# Build in a different image to keep the target image clean
FROM node:22-alpine AS build
RUN apk add --no-cache python3 make g++ py3-setuptools
RUN npm install -g pnpm@10.33.0
WORKDIR /app
COPY ./package.json ./pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY ./ ./
RUN pnpm build \
&& pnpm swagger
RUN HUSKY=0 pnpm install --prod --frozen-lockfile
# The target image that will be run
FROM node:22-alpine AS target
RUN apk add openssl
WORKDIR /app
COPY --from=build --chown=node /app/node_modules /app/node_modules
RUN npm install -g @socket.io/pm2 pm2-graceful-intercom typeorm
COPY --from=build --chown=node /app/init_scripts /app/init_scripts
COPY --from=build --chown=node /app/pm2.json /app/pm2.json
RUN chmod +x /app/init_scripts/start.sh
COPY --from=build --chown=node /app/out/src /app/out/src
COPY --from=build --chown=node /app/out/swagger.json /app/out/swagger.json
COPY --from=build --chown=node /app/static /app/out/static
CMD ["sh", "/app/init_scripts/start.sh"]