File size: 685 Bytes
6df0f05
 
c182040
6df0f05
 
 
 
 
 
eab63c1
 
090e019
e2944ba
6df0f05
82c9006
eab63c1
82c9006
2a40225
6df0f05
7dea287
6df0f05
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 使用 python:3.10.9-slim 作为基础镜像
FROM python:3.10.9-slim

# 设置工作目录
WORKDIR /app

# 复制当前目录内容到容器内的 /app 目录
COPY . /app

ENV INDEX_HTML=/app/index.html

RUN --mount=type=secret,id=PLAYER_SCRIPT,mode=0444,required=true \
  cat /run/secrets/PLAYER_SCRIPT > /app/player.py && chmod 755 /app/player.py

  RUN --mount=type=secret,id=HTML_SCRIPT,mode=0444,required=true \
    cat /run/secrets/HTML_SCRIPT > $INDEX_HTML && chmod 755 $INDEX_HTML


# 安装crontab和其他依赖
RUN apt-get update && apt-get install -y cron wget git && \
    pip install --no-cache-dir -r requirements.txt

CMD uvicorn player:app --host 0.0.0.0 --port 7860