Skip to content

Commit 3808661

Browse files
authored
feat: enhance Dockerfile for Playwright (#6)
* feat: enhance Dockerfile for Playwright and add font support - Install system dependencies for Playwright including Chromium and font packages. - Configure Playwright to use the installed Chromium in Docker. - Add a function to set the font family for Mermaid diagrams, supporting custom overrides and ensuring Chinese font compatibility. * chore: add .dockerignore and optimize Dockerfile for cleaner builds - Introduced .dockerignore to exclude unnecessary files from Docker context. - Updated Dockerfile to streamline dependency installation and build process, including Playwright with system Chromium.
1 parent 30f747d commit 3808661

2 files changed

Lines changed: 30 additions & 12 deletions

File tree

.dockerignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies and build artifacts
2+
node_modules
3+
build
4+
dist
5+
6+
# Development files
7+
.git
8+
.env*
9+
*.log
10+
11+
# IDE and editor files
12+
.vscode
13+
.idea
14+
15+
# Test and CI files
16+
.github
17+
test_*.js
18+
19+
# Documentation
20+
README.md

Dockerfile

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
FROM node:lts-alpine
1+
FROM node:lts-bookworm-slim
22

33
WORKDIR /app
44

5-
# Copy package files
6-
COPY package*.json ./
7-
8-
# Install dependencies
9-
RUN npm install --ignore-scripts
10-
11-
# Copy application code
125
COPY . .
136

14-
# Build the application
15-
RUN npm run build
7+
RUN npm install \
8+
&& npm run build \
9+
&& npx playwright install --with-deps chromium \
10+
&& apt-get clean \
11+
&& npm prune --omit=dev \
12+
&& npm cache clean --force \
13+
&& rm -rf /var/lib/apt/lists/* \
14+
&& rm -rf /var/cache/apt/*
1615

17-
# Command will be provided by smithery.yaml
18-
CMD ["node", "build/index.js"]
16+
CMD ["node", "build/index.js"]

0 commit comments

Comments
 (0)