Skip to content

Commit b3dd8b5

Browse files
authored
Merge pull request #62 from mashb1t/mashb1t-feature/queue-driver-rq
fix: correctly use worker
2 parents 176fec7 + 6c49a96 commit b3dd8b5

File tree

5 files changed

+31
-13
lines changed

5 files changed

+31
-13
lines changed

.github/workflows/build_image.yml renamed to .github/workflows/build_images.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ jobs:
4545
type=semver,pattern={{major}}
4646
type=edge,branch=main
4747
48+
- name: Extract metadata (tags, labels) for Docker (worker)
49+
id: meta_worker
50+
uses: docker/metadata-action@v5
51+
with:
52+
images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
53+
tags: |
54+
type=semver,pattern={{version}},suffix=-worker
55+
type=semver,pattern={{major}}.{{minor}},suffix=-worker
56+
type=semver,pattern={{major}},suffix=-worker
57+
type=edge,branch=main,suffix=-worker
58+
4859
# Build and push multi-arch prod image
4960
- name: Build and push prod Docker image (Multi-Arch)
5061
uses: docker/build-push-action@v6
@@ -56,3 +67,15 @@ jobs:
5667
tags: ${{ steps.meta_prod.outputs.tags }}
5768
labels: ${{ steps.meta_prod.outputs.labels }}
5869
target: prod
70+
71+
# Build and push multi-arch worker image
72+
- name: Build and push worker Docker image (Multi-Arch)
73+
uses: docker/build-push-action@v6
74+
with:
75+
context: .
76+
file: ./Dockerfile
77+
push: true
78+
platforms: linux/amd64,linux/arm64/v8
79+
tags: ${{ steps.meta_worker.outputs.tags }}
80+
labels: ${{ steps.meta_worker.outputs.labels }}
81+
target: worker

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@ COPY api.py ./api.py
1919
COPY ui.py ./ui.py
2020
COPY conf/prompt_templates.yml ./conf/prompt_templates.yml
2121

22-
# 暴露 Flask 和 Streamlit 的端口
23-
EXPOSE 5001 5002
24-
2522
# 使用 supervisord 作为启动命令
2623
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
2724

2825
FROM base AS dev
2926
COPY ./conf/supervisord.dev.conf /etc/supervisor/conf.d/supervisord.conf
27+
# 暴露 Flask 和 Streamlit 的端口
28+
EXPOSE 5001 5002
3029

3130
FROM base AS prod
3231
COPY ./conf/supervisord.prod.conf /etc/supervisor/conf.d/supervisord.conf
32+
# 暴露 Flask 和 Streamlit 的端口
33+
EXPOSE 5001 5002
3334

3435
FROM base AS worker
3536
COPY ./conf/supervisord.worker.conf /etc/supervisor/conf.d/supervisord.conf

conf/supervisord.worker.conf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ nodaemon=true
33
user=root
44

55
[program:worker]
6-
#command=rq worker %(ENV_WORKER_QUEUE)s --url redis://redis:6379 --path /app
7-
command=rq worker gitlab_yj_edusoho_cn --url redis://redis:6379 --path /app
6+
command=rq worker %(ENV_WORKER_QUEUE)s --url redis://redis:6379 --path /app
87
autostart=true
98
autorestart=true
109
numprocs=1

docker-compose.prod.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
context: .
2525
dockerfile: Dockerfile
2626
target: worker
27-
# image: sunmh207/ai-codereview-gitlab:1.3.1-worker
27+
image: ghcr.io/sunmh207/ai-codereview-gitlab:1.3.1-worker
2828
volumes_from:
2929
- app
3030
env_file:
@@ -42,7 +42,7 @@ services:
4242
# context: .
4343
# dockerfile: Dockerfile
4444
# target: worker
45-
# # image: sunmh207/ai-codereview-gitlab:1.3.1-worker
45+
# image: ghcr.io/sunmh207/ai-codereview-gitlab:1.3.1-worker
4646
# volumes_from:
4747
# - app
4848
# env_file:
@@ -57,8 +57,6 @@ services:
5757

5858
redis:
5959
image: redis:alpine
60-
# ports:
61-
# - "${REDIS_PORT}:6379"
6260
volumes:
6361
- redis_data:/data
6462
restart: unless-stopped

docker-compose.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ services:
1111
volumes:
1212
- ./biz:/app/biz
1313
- ./conf:/app/conf
14-
- ./conf/supervisord.dev.conf:/etc/supervisor/conf.d/supervisord.conf
1514
- ./data:/app/data
1615
- ./log:/app/log
1716
- ./api.py:/app/api.py
@@ -29,7 +28,7 @@ services:
2928
context: .
3029
dockerfile: Dockerfile
3130
target: worker
32-
# image: sunmh207/ai-codereview-gitlab:1.2.3-worker
31+
image: ghcr.io/sunmh207/ai-codereview-gitlab:1.3.1-worker
3332
volumes_from:
3433
- app
3534
env_file:
@@ -41,8 +40,6 @@ services:
4140

4241
redis:
4342
image: redis:alpine
44-
env_file:
45-
- ./conf/.env
4643
ports:
4744
- "6379:6379"
4845
volumes:

0 commit comments

Comments
 (0)