jljiu commited on
Commit
ffe74f9
·
verified ·
1 Parent(s): 6346835

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -9
Dockerfile CHANGED
@@ -3,24 +3,31 @@ FROM ubuntu:latest
3
 
4
  # 更新软件包列表并安装所需软件
5
  RUN apt -y update && \
6
- apt -y install curl unzip
7
 
8
  # 安装Deno
9
  RUN curl -fsSL https://deno.land/x/install/install.sh | sh
10
 
11
  # 设置环境变量,将Deno可执行文件路径添加到PATH中
12
- ENV DENO_INSTALL="/root/.deno"
13
- ENV PATH="$DENO_INSTALL/bin:$PATH"
14
 
15
- # 安装Puppeteer相关依赖并尝试下载浏览器二进制文件
16
- RUN deno install --global --allow-read --allow-write --allow-net --allow-run --allow-env --unstable -f https://deno.land/x/puppeteer@16.2.0/install.ts && \
17
- PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts
 
 
 
18
 
19
  # 复制本地的main.ts文件到容器中
20
  COPY main.ts ./
21
 
22
- # 暴露7860端口,和你之前期望使用的端口保持一致
23
  EXPOSE 7860
24
 
25
- # 运行Deno应用,添加相应的权限参数
26
- CMD ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "--allow-run", "--allow-env", "--unstable", "main.ts"]
 
 
 
 
 
3
 
4
  # 更新软件包列表并安装所需软件
5
  RUN apt -y update && \
6
+ apt -y install curl unzip nodejs npm
7
 
8
  # 安装Deno
9
  RUN curl -fsSL https://deno.land/x/install/install.sh | sh
10
 
11
  # 设置环境变量,将Deno可执行文件路径添加到PATH中
12
+ ENV DENO_INSTALL = "/root/.deno"
13
+ ENV PATH = "$DENO_INSTALL/bin:$PATH"
14
 
15
+ # 创建项目目录并进入
16
+ WORKDIR /app
17
+ RUN mkdir -p /app/node_modules
18
+
19
+ # 安装Puppeteer相关依赖
20
+ RUN deno install -A --unstable -f https://deno.land/x/puppeteer@16.2.0/install.ts
21
 
22
  # 复制本地的main.ts文件到容器中
23
  COPY main.ts ./
24
 
25
+ # 暴露7860端口
26
  EXPOSE 7860
27
 
28
+ # 运行手动安装Chromium的命令
29
+ RUN npm install puppeteer
30
+ RUN node node_modules/puppeteer/install.js
31
+
32
+ # 运行Deno应用
33
+ CMD ["deno", "run", "-A", "--unstable", "main.ts"]