-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.tests.component
More file actions
50 lines (43 loc) · 1.83 KB
/
Copy pathDockerfile.tests.component
File metadata and controls
50 lines (43 loc) · 1.83 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Stage 1: Base stage with system dependencies and Playwright browsers
FROM ubuntu:24.04 AS base
# Install base utilities and Node.js 20
RUN apt-get update && \
apt-get install -y curl wget gnupg ca-certificates && \
# Install Node.js 20 (as in GitHub Actions)
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
# Install pnpm 10.6.2 (as in GitHub Actions)
npm install -g pnpm@10.6.2 && \
# Install system dependencies for fonts (as in CI)
apt-get install -y \
libfontconfig1 \
fonts-liberation \
fonts-dejavu-core \
fontconfig && \
# Clean apt cache
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Playwright browsers
# Create a temporary package.json with the playwright version from the project
# Version is hardcoded: playwright@1.52.0 (matches the version in package.json)
RUN echo '{"dependencies":{"playwright":"1.52.0"}}' > /tmp/package.json && \
cd /tmp && \
npm install && \
npx playwright install --with-deps chromium && \
rm -rf /tmp/node_modules /tmp/package.json /root/.npm /root/.cache/npm
# Stage 2: Final stage with the project code
FROM base AS final
WORKDIR /app
# Copy root files required by pnpm
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
# Copy only package.json files from .docker-package-json structure
# This structure is prepared by scripts/component-tests/prepare-package-json.ts
# and contains only package.json files to minimize image size and improve caching
COPY .docker-package-json/packages/ ./packages/
COPY .docker-package-json/apps/ ./apps/
# Install dependencies
RUN pnpm install --frozen-lockfile && \
# Clean pnpm store to reduce image size
pnpm store prune && \
# Remove unnecessary files (but keep the Playwright browser cache)
rm -rf /root/.npm /root/.cache/npm