Skip to content

Commit f91f3ac

Browse files
authored
Update config.yaml
1 parent 3876698 commit f91f3ac

File tree

1 file changed

+79
-46
lines changed

1 file changed

+79
-46
lines changed

config.yaml

Lines changed: 79 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,79 @@
1-
domain: "" #填写域名后对外提供链接将使用域名替代 ip:scheduler_port
2-
interpreter_image: "leezhuuu/code_interpreter"
3-
scheduler_port: 5000 # 调度中心自定义端口
4-
host: "0.0.0.0" # 调度中心自定义 host 地址
5-
interpreter_port_range: # 设置端口范围为 8001-8003,端口范围决定容器数量
6-
start: 8001
7-
end: 8003
8-
dependencies: # 定义容器的依赖项,以下为默认依赖项,可以根据需要自行更改,仅在生成自定义镜像时生效
9-
- numpy
10-
- pandas
11-
- scipy
12-
- matplotlib
13-
- seaborn
14-
- scikit-learn
15-
- opencv-python
16-
- opencv-python-headless
17-
- Pillow
18-
- requests
19-
- Flask
20-
- pyyaml
21-
- sympy
22-
- plotly
23-
- bokeh
24-
- statsmodels
25-
- jupyter
26-
- ipython
27-
- jupyterlab
28-
- pytest
29-
- hypothesis
30-
- Flask-Cors
31-
- Werkzeug
32-
- Gunicorn
33-
- handcalcs
34-
resource_limits:
35-
memory: "" # 可以自定义内存限制,例如 "2g"、"500m" 等,不填则默认不进行限制
36-
cpus: "" # 可以自定义 CPU 限制,例如 "1.5"、"0.5" 等,不填则默认不进行限制
37-
timeout_seconds: 60 # 设置超时时间为 1 分钟(60 秒)
38-
postgres:
39-
user: "user" # 数据库用户名,请自行更改
40-
password: "password" # 数据库密码,请自行更改
41-
db: "code_interpreter_db"
42-
host: "localhost"
43-
port: "5432" # 数据库端口,请自行更改
44-
mode: "docker" # 选择运行模式,可以是 "docker"、"podman" 或 "k8s",k8s模式正在开发中
45-
kubeconfig_path: "/path/to/kubeconfig.yaml" # Kubernetes 配置文件路径
46-
k8s_interpreter_yaml: "/path/to/code-interpreter.yaml" # Kubernetes 部署配置文件路径
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v1
21+
22+
- name: Log in to Docker Hub
23+
uses: docker/login-action@v2
24+
with:
25+
username: ${{ secrets.DOCKER_USERNAME }}
26+
password: ${{ secrets.DOCKER_PASSWORD }}
27+
28+
- name: Install yq
29+
run: |
30+
sudo apt-get update -y
31+
sudo apt-get install -y python3-pip
32+
pip3 install yq
33+
34+
- name: Read config.yaml and generate Dockerfile
35+
id: generate_dockerfile
36+
run: |
37+
dependencies=$(yq e '.dependencies[]' config.yaml | tr '\n' ' ')
38+
if [ -z "$dependencies" ]; then
39+
echo "No dependencies found in config.yaml"
40+
exit 1
41+
fi
42+
cat > Dockerfile <<EOL
43+
FROM python:3.10-slim
44+
45+
WORKDIR /app
46+
47+
RUN apt-get update && apt-get install -y \\
48+
build-essential \\
49+
libssl-dev \\
50+
libffi-dev \\
51+
python3-dev \\
52+
libyaml-dev \\
53+
&& apt-get clean \\
54+
&& pip install --no-cache-dir --upgrade pip \\
55+
&& pip install --no-cache-dir cython \\
56+
&& pip install --no-cache-dir $dependencies
57+
58+
COPY . .
59+
60+
ENV PYTHONUNBUFFERED=1
61+
62+
EXPOSE 5000
63+
64+
CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"]
65+
EOL
66+
67+
- name: Build and push Docker image
68+
uses: docker/build-push-action@v2
69+
with:
70+
context: .
71+
file: ./Dockerfile
72+
push: true
73+
tags: |
74+
${{ secrets.DOCKER_USERNAME }}/code_interpreter:latest
75+
${{ secrets.DOCKER_USERNAME }}/code_interpreter:${{ github.sha }}
76+
77+
- name: Clean up Docker images
78+
run: |
79+
docker image prune -f

0 commit comments

Comments
 (0)