1- FROM node:18-slim AS base
1+ # Build stage
2+ FROM node:18-slim AS build
23WORKDIR /app
3- RUN apt update && apt install -y \
4- g++ make python3 wget gnupg dirmngr unzip
4+ RUN apt-get update && apt-get install -y --no-install-recommends \
5+ g++ make python3 wget gnupg dirmngr unzip \
6+ && rm -rf /var/lib/apt/lists/*
7+
8+ RUN npm --no-update-notifier --no-fund --global install pnpm
9+
10+ COPY . .
11+ RUN pnpm install && pnpm build
512
613# Server stage
7- FROM base AS server
14+ FROM node:18-slim AS server
15+ WORKDIR /app
816COPY ./server/ .
917RUN yarn config set registry https://registry.npmjs.org/ && \
1018 yarn config set network-timeout 1200000 && \
1119 yarn install --frozen-lockfile && \
1220 yarn build
1321
14- # Build stage
15- FROM base AS build
16- RUN npm --no-update-notifier --no-fund --global install pnpm
17- COPY . .
18- RUN pnpm install && pnpm build
19-
2022# Final stage
2123FROM node:18-slim
2224WORKDIR /app
2325
24- # Set environment variables
2526ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
2627ENV NODE_ENV=production
27- # Install dependencies
28- RUN apt update && apt install -y wget gnupg dirmngr unzip
29- # Install dependencies and google chrome based on architecture
30- RUN apt update && apt install -y wget gnupg dirmngr curl && \
31- ARCH=$(dpkg --print-architecture) && \
28+
29+ RUN apt-get update && apt-get install -y --no-install-recommends \
30+ wget gnupg dirmngr curl ca-certificates git git-lfs openssh-client \
31+ jq cmake sqlite3 openssl psmisc python3 g++ make \
32+ && rm -rf /var/lib/apt/lists/*
33+
34+ # Install Chrome based on architecture
35+ RUN ARCH=$(dpkg --print-architecture) && \
3236 if [ "$ARCH" = "amd64" ]; then \
33- wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
34- sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
35- apt-get update && \
36- apt-get install google-chrome-stable -y --no-install-recommends; \
37+ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
38+ echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
39+ apt-get update && apt-get install -y google-chrome-stable --no-install-recommends; \
3740 elif [ "$ARCH" = "arm64" ]; then \
3841 wget -q -O chromium-linux-arm64.zip 'https://playwright.azureedge.net/builds/chromium/1088/chromium-linux-arm64.zip' && \
3942 unzip chromium-linux-arm64.zip && \
@@ -43,15 +46,9 @@ RUN apt update && apt install -y wget gnupg dirmngr curl && \
4346 else \
4447 echo "Unsupported architecture: $ARCH" && exit 1; \
4548 fi && \
46- rm -rf /var/lib/apt/lists/* \
47- && apt-get clean && rm -rf /var/lib/{apt,dpkg,cache,log}/
48-
49- # Install other dependencies
50- RUN apt update && apt install -y --no-install-recommends \
51- ca-certificates git git-lfs openssh-client curl jq cmake sqlite3 openssl psmisc python3 g++ make && \
52- apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/
49+ rm -rf /var/lib/apt/lists/*
5350
54- # Copying build artifacts
51+ # Copy build artifacts
5552COPY --from=server /app/dist/ .
5653COPY --from=server /app/prisma/ ./prisma
5754COPY --from=server /app/package.json .
@@ -65,5 +62,4 @@ RUN yarn config set registry https://registry.npmjs.org/ && \
6562 yarn config set network-timeout 1200000 && \
6663 yarn install --production --frozen-lockfile
6764
68- # Start the application
6965CMD ["yarn" , "start" ]
0 commit comments