11# Stage 1: Build the application
2- FROM node:18-slim as build
3-
4-
2+ FROM node:18-alpine AS build
53
4+ # Install OpenSSL
5+ RUN apk add --no-cache openssl
66RUN npm install -g pnpm
77
8- # We don't need the standalone Chromium
9- ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
10- ENV PUPPETEER_SKIP_DOWNLOAD true
11-
12- # Install Google Chrome Stable and fonts
13- # Note: this installs the necessary libs to make the browser work with Puppeteer.
14- RUN apt-get update && apt-get install openssl gnupg wget -y && \
15- wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
16- sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
17- apt-get update && \
18- apt-get install google-chrome-stable -y --no-install-recommends && \
19- rm -rf /var/lib/apt/lists/*
20-
21- # RUN apk update && apk list --all-versions chromium
228# Set the working directory
239WORKDIR /app
2410
2511# Copy package.json and package-lock.json
2612COPY package.json ./
2713
14+ ENV PUPPETEER_SKIP_DOWNLOAD=true
15+
2816# Install dependencies
29- RUN pnpm install
17+ RUN pnpm i --ignore-scripts
3018
3119# Copy the rest of the application code
3220COPY . .
@@ -37,24 +25,11 @@ RUN cd libs/prisma-service && npx prisma generate
3725RUN pnpm run build user
3826
3927# Stage 2: Create the final image
40- FROM node:18-slim
41-
42- # We don't need the standalone Chromium
43- ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
44- ENV PUPPETEER_SKIP_DOWNLOAD true
45-
46- # Install Google Chrome Stable and fonts
47- # Note: this installs the necessary libs to make the browser work with Puppeteer.
48- RUN apt-get update && apt-get install openssl gnupg wget -y && \
49- wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
50- sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
51- apt-get update && \
52- apt-get install google-chrome-stable -y --no-install-recommends && \
53- rm -rf /var/lib/apt/lists/*
28+ FROM node:18-alpine
5429
30+ RUN apk add --no-cache openssl
5531# Set the working directory
5632WORKDIR /app
57- RUN npm install -g pnpm
5833
5934# Copy the compiled code from the build stage
6035COPY --from=build /app/dist/apps/user/ ./dist/apps/user/
0 commit comments