# 使用官方的Ubuntu作为基础镜像 FROM ubuntu:latest # 更新软件包列表并安装所需软件 RUN apt -y update && \ apt -y install curl unzip xubuntu-desktop # 安装 Deno RUN curl -fsSL https://deno.land/x/install/install.sh | sh # 设置环境变量,将Deno可执行文件路径添加到PATH中 ENV DENO_INSTALL="/root/.deno" ENV PATH="$DENO_INSTALL/bin:$PATH" # 创建项目目录并进入 WORKDIR /app # 复制本地的ts文件到容器中 COPY main.ts ./ COPY index.html ./ # 手动下载和安装最新版本的 Chrome RUN apt-get update && apt-get install -y wget unzip jq curl && \ CHROME_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json | jq -r '.channels.Stable.version') && \ wget -q "https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chrome-linux64.zip" -O /tmp/chrome.zip && \ mkdir -p /app/chrome && \ unzip /tmp/chrome.zip -d /app/chrome && \ rm /tmp/chrome.zip && \ chmod +x /app/chrome/chrome-linux64/chrome # 暴露7860端口 EXPOSE 7860 # 运行Deno应用 CMD ["deno", "run", "-A", "main.ts"]