File size: 1,095 Bytes
5ec1f52
 
 
 
 
 
 
 
 
 
 
fa06d21
0abb825
 
 
ffc3b87
 
 
 
 
 
0abb825
 
 
b6b2405
 
0abb825
 
 
 
 
 
99d3158
5ec1f52
 
 
 
 
 
 
 
 
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
FROM langgenius/dify-sandbox:0.2.12

ENV API_KEY=dify-sandbox \
    GIN_MODE=release \
    WORKER_TIMEOUT=15 \
    ENABLE_NETWORK=true \
    HTTP_PROXY=https://yixian56-ssrf-proxy.hf.space \
    HTTPS_PROXY=https://yixian56-ssrf-proxy.hf.space \
    SANDBOX_PORT=8194

# 创建必要的目录
WORKDIR /app
RUN mkdir -p logs /dependencies /conf /app/conf /var/sandbox/sandbox-nodejs

# 创建 Python 依赖文件
RUN echo '# Python依赖列表 \
requests==2.31.0 \
beautifulsoup4==4.12.2 \
numpy==1.26.1 \
pandas==2.1.1 \
matplotlib==3.8.0 \
' > /dependencies/python-requirements.txt

# 复制本地配置文件到容器内
COPY config.yaml /app/conf/config.yaml

# 使用root权限预先创建Python沙箱目录
USER root
RUN mkdir -p /var/sandbox/sandbox-python && \
    chmod -R 777 /var/sandbox && \
    # 确保日志目录有正确权限
    chmod -R 777 /app/logs

# 健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  CMD curl -f http://localhost:8194/health || exit 1

# 暴露沙盒服务端口
EXPOSE 8194

# 启动沙盒服务
CMD ["/app/sandbox"]