aripbae commited on
Commit
b0c1e98
·
verified ·
1 Parent(s): 7ba7eb4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -27
Dockerfile CHANGED
@@ -1,17 +1,11 @@
1
- # 基础镜像:使用 Node.js 20 的 Alpine Linux 版本
2
  FROM node:20-alpine
3
 
4
- # 设置工作目录
5
  WORKDIR /app
6
-
7
- # 安装系统依赖
8
  RUN apk add --no-cache \
9
- # 基本构建工具
10
  python3 \
11
  make \
12
  g++ \
13
  git \
14
- # Playwright 依赖
15
  chromium \
16
  nss \
17
  freetype \
@@ -19,38 +13,22 @@ RUN apk add --no-cache \
19
  harfbuzz \
20
  ca-certificates \
21
  ttf-freefont \
22
- # 其他依赖
23
  gcompat
24
 
25
- # 设置 Playwright 的环境变量
26
- ENV PLAYWRIGHT_BROWSERS_PATH /usr/bin \
27
- PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD 1 \
28
- PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH /usr/bin/chromium-browser \
29
- PLAYWRIGHT_SKIP_BROWSER_VALIDATION 1
30
 
31
- # 复制依赖文件并安装
32
- RUN git clone https://github.com/zhezzma/playwright-proxy $WORKDIR
33
- COPY package*.json tsconfig.json ./
34
- RUN npm install
35
 
36
- # 复制源代码和静态文件
37
- COPY src/ ./src/
38
- COPY index.html ./index.html
39
  RUN npm run build
40
 
41
- # 创建非 root 用户和用户组
42
  RUN addgroup -S -g 1001 nodejs && \
43
  adduser -S -D -H -u 1001 -G nodejs hono
44
-
45
- # 设置应用文件的所有权
46
  RUN chown -R hono:nodejs /app
47
 
48
- # 切换到非 root 用户
49
  USER hono
50
-
51
- # 声明容器要暴露的端口
52
  EXPOSE 7860
53
- ENV PORT 7860
54
 
55
- # 启动应用
56
  CMD ["node", "dist/index.js"]
 
 
1
  FROM node:20-alpine
2
 
 
3
  WORKDIR /app
 
 
4
  RUN apk add --no-cache \
 
5
  python3 \
6
  make \
7
  g++ \
8
  git \
 
9
  chromium \
10
  nss \
11
  freetype \
 
13
  harfbuzz \
14
  ca-certificates \
15
  ttf-freefont \
 
16
  gcompat
17
 
18
+ ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 \
19
+ PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium-browser \
20
+ PORT=7860
 
 
21
 
22
+ RUN git clone --depth 1 https://github.com/zhezzma/playwright-proxy .
 
 
 
23
 
24
+ RUN npm install
 
 
25
  RUN npm run build
26
 
 
27
  RUN addgroup -S -g 1001 nodejs && \
28
  adduser -S -D -H -u 1001 -G nodejs hono
 
 
29
  RUN chown -R hono:nodejs /app
30
 
 
31
  USER hono
 
 
32
  EXPOSE 7860
 
33
 
 
34
  CMD ["node", "dist/index.js"]