File size: 1,676 Bytes
ce2ce6f
 
8677d0c
ce2ce6f
 
 
568cc0c
0bd2cb4
ce2ce6f
 
 
 
 
 
 
 
 
 
 
16ed7da
35451ff
108a3e8
 
 
 
 
 
 
 
 
35451ff
108a3e8
35451ff
 
108a3e8
 
 
 
ce2ce6f
 
0bd2cb4
 
ce2ce6f
16ed7da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 使用官方Ubuntu基础镜像
FROM ubuntu:22.04

# 设置环境变量
ENV APP_HOME /app
ENV DEBIAN_FRONTEND noninteractive

# 安装必要的依赖
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    curl \
    jq \
    tar \
    && rm -rf /var/lib/apt/lists/*

# 创建应用目录
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME

# 下载并解压rustdesk-api的最新版本
RUN set -eux; \
    # 获取API响应并保存到临时文件,方便调试
    curl -s https://api.github.com/repos/lejianwen/rustdesk-api/releases/latest > latest_release.json; \
    # 显示API响应中的所有资产名称,帮助调试
    echo "Available assets:"; \
    jq -r '.assets[].name' latest_release.json; \
    # 尝试多种匹配方式,确保能找到正确的资产
    URL=$(jq -r '.assets[] | select(.name | test("(?i)linux-amd64.tar.gz")) | .browser_download_url' latest_release.json || \
          jq -r '.assets[] | select(.name | contains("linux") and contains("amd64") and contains("tar.gz")) | .browser_download_url' latest_release.json || \
          jq -r '.assets[0].browser_download_url' latest_release.json); \
    echo "Downloading from: $URL"; \
    [ -n "$URL" ] || { echo "Error: Failed to find download URL"; exit 1; }; \
    curl -L -o linux-amd64.tar.gz "$URL"; \
    tar -xzf linux-amd64.tar.gz; \
    rm linux-amd64.tar.gz; \
    # 验证文件是否成功下载
    ls -la; \
    [ -f rustdesk-api ] || { echo "Error: rustdesk-api binary not found"; exit 1; }

# 暴露应用端口(根据实际应用调整)
EXPOSE 8080

# 设置容器启动命令(根据实际应用调整)
CMD ["./rustdesk-api", "--config", "config.toml"]