This commit is contained in:
32
Dockerfile
32
Dockerfile
@ -2,13 +2,29 @@ FROM node:24-alpine AS builder
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install Chromium and dependencies for Playwright in a single layer
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
chromium \
|
||||||
|
nss \
|
||||||
|
freetype \
|
||||||
|
freetype-dev \
|
||||||
|
harfbuzz \
|
||||||
|
ca-certificates \
|
||||||
|
ttf-freefont \
|
||||||
|
curl \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# Tell Playwright to use the installed Chromium
|
||||||
|
ENV PLAYWRIGHT_BROWSERS_PATH=/usr/bin
|
||||||
|
ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||||
|
|
||||||
# Install pnpm
|
# Install pnpm
|
||||||
RUN npm i -g pnpm
|
RUN npm i -g pnpm
|
||||||
|
|
||||||
# Copy package files
|
# Copy package files
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
|
||||||
# Install dependencies
|
# Install all dependencies (including dev dependencies for build)
|
||||||
RUN pnpm install --frozen-lockfile
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
@ -17,19 +33,7 @@ COPY . .
|
|||||||
# Build the application
|
# Build the application
|
||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
|
|
||||||
# Production stage
|
# Install only production dependencies and clean up
|
||||||
FROM mcr.microsoft.com/playwright:v1.50.0-noble AS runtime
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install pnpm
|
|
||||||
RUN npm i -g pnpm
|
|
||||||
|
|
||||||
# Copy built application and package files
|
|
||||||
COPY --from=builder /app/dist ./dist
|
|
||||||
COPY --from=builder /app/package.json /app/pnpm-lock.yaml ./
|
|
||||||
|
|
||||||
# Install production dependencies and clean up in one layer
|
|
||||||
RUN pnpm install --prod --frozen-lockfile \
|
RUN pnpm install --prod --frozen-lockfile \
|
||||||
&& pnpm store prune \
|
&& pnpm store prune \
|
||||||
&& npm cache clean --force
|
&& npm cache clean --force
|
||||||
|
Reference in New Issue
Block a user