-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (37 loc) · 1.44 KB
/
Dockerfile
File metadata and controls
48 lines (37 loc) · 1.44 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
FROM node:22
ARG VERSION
WORKDIR /app
RUN apt-get update \
&& apt-get install -y vim git build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency files for version extraction
COPY package.json pnpm-lock.yaml ./
# Parse peerDependenciesMeta and install corresponding versions
RUN node -e " \
const fs = require('fs'); \
const { execSync } = require('child_process'); \
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8')); \
const lock = fs.readFileSync('./pnpm-lock.yaml', 'utf8'); \
const peers = Object.keys(pkg.peerDependenciesMeta || {}); \
const packages = peers.map(name => { \
const regex = new RegExp('[/\\\\s]' + name + '@([0-9.]+)[:\\\\)]'); \
const match = lock.match(regex); \
if (!match) throw new Error('Version not found in lockfile for: ' + name); \
return name + '@' + match[1]; \
}); \
console.log('Installing peerDependencies:', packages.join(' ')); \
if (packages.length > 0) { \
execSync('npm install -g ' + packages.join(' '), { stdio: 'inherit' }); \
} \
"
# Set environment variables
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright-browsers
ENV NODE_PATH=/usr/local/lib/node_modules
# Install Playwright browsers and system dependencies
RUN npx playwright install --with-deps chromium \
&& chmod -R 755 $PLAYWRIGHT_BROWSERS_PATH
RUN npm install -g pnpm
# Install coderio
RUN npm install -g coderio@${VERSION#v}
# Clean up temporary files
RUN rm -f package.json pnpm-lock.yaml