1
1
# Stage 1: Build the application
2
- FROM node:18-slim as build
3
-
4
-
2
+ FROM node:18-alpine AS build
5
3
4
+ # Install OpenSSL
5
+ RUN apk add --no-cache openssl
6
6
RUN npm install -g pnpm
7
7
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
22
8
# Set the working directory
23
9
WORKDIR /app
24
10
25
11
# Copy package.json and package-lock.json
26
12
COPY package.json ./
27
13
14
+ ENV PUPPETEER_SKIP_DOWNLOAD=true
15
+
28
16
# Install dependencies
29
- RUN pnpm install
17
+ RUN pnpm i --ignore-scripts
30
18
31
19
# Copy the rest of the application code
32
20
COPY . .
@@ -37,24 +25,11 @@ RUN cd libs/prisma-service && npx prisma generate
37
25
RUN pnpm run build user
38
26
39
27
# 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
54
29
30
+ RUN apk add --no-cache openssl
55
31
# Set the working directory
56
32
WORKDIR /app
57
- RUN npm install -g pnpm
58
33
59
34
# Copy the compiled code from the build stage
60
35
COPY --from=build /app/dist/apps/user/ ./dist/apps/user/
0 commit comments