jljiu commited on
Commit
c10ad6c
·
verified ·
1 Parent(s): 3589597

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile CHANGED
@@ -1,3 +1,39 @@
1
  # 使用官方的Ubuntu作为基础镜像
2
  FROM ubuntu:latest
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # 使用官方的Ubuntu作为基础镜像
2
  FROM ubuntu:latest
3
 
4
+ # 更新软件包列表并安装所需软件
5
+ RUN apt -y update && \
6
+ apt -y install curl unzip xubuntu-desktop
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
+
18
+ # 复制本地文件到容器中
19
+ COPY main.ts ./
20
+ COPY index.html ./
21
+ COPY deno.json ./
22
+
23
+ # 手动下载和安装最新版本的 Chrome
24
+ RUN apt-get update && apt-get install -y wget unzip jq curl && \
25
+ CHROME_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json | jq -r '.channels.Stable.version') && \
26
+ wget -q "https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chrome-linux64.zip" -O /tmp/chrome.zip && \
27
+ mkdir -p /app/chrome && \
28
+ unzip /tmp/chrome.zip -d /app/chrome && \
29
+ rm /tmp/chrome.zip && \
30
+ chmod +x /app/chrome/chrome-linux64/chrome
31
+
32
+ # 暴露7860端口
33
+ EXPOSE 7860
34
+
35
+ # 以root用户运行,解决权限问题
36
+ USER root
37
+
38
+ # 运行Deno应用
39
+ CMD ["deno", "run", "-A", "main.ts"]