From e7536092498f8d2ef57b4f10bee6de90980e392d Mon Sep 17 00:00:00 2001 From: zjw <2956131242@qq.com> Date: Thu, 16 Apr 2026 09:50:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++-- config.yaml | 2 +- docker-compose.python.yml | 12 ++++++++++++ start.sh | 27 +++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 docker-compose.python.yml create mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile index c6fdd28..47f61e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.12-slim +FROM registry.bjzgzp.com:4433/library/python3.12:base WORKDIR /app @@ -15,4 +15,4 @@ COPY . . EXPOSE 8000 -CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "18000"] diff --git a/config.yaml b/config.yaml index 2e68628..925435a 100644 --- a/config.yaml +++ b/config.yaml @@ -1,5 +1,5 @@ server: - port: 8000 + port: 18000 log_level: INFO storage: diff --git a/docker-compose.python.yml b/docker-compose.python.yml new file mode 100644 index 0000000..d852fb6 --- /dev/null +++ b/docker-compose.python.yml @@ -0,0 +1,12 @@ +version: "3.9" + +services: + python-service: + image: label-ai-service:latest + build: + context: . + dockerfile: Dockerfile + container_name: label-ai-service + ports: + - "18000:18000" + restart: unless-stopped diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..93204af --- /dev/null +++ b/start.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" + +COMPOSE_CMD="docker compose" +if ! docker compose version >/dev/null 2>&1; then + if command -v docker-compose >/dev/null 2>&1; then + COMPOSE_CMD="docker-compose" + else + echo "Error: docker compose and docker-compose are both unavailable." >&2 + exit 1 + fi +fi + +echo "==> Pulling latest code..." +git pull + +echo "==> Building image..." +docker build -t label-ai-service:latest -f Dockerfile . + +echo "==> Starting service..." +$COMPOSE_CMD -f docker-compose.python.yml up -d + +echo "==> Service started. Check logs with:" +echo " $COMPOSE_CMD -f docker-compose.python.yml logs -f python-service" From 58802d40fee04b5f647d7a39d0063edb6842b556 Mon Sep 17 00:00:00 2001 From: zjw <2956131242@qq.com> Date: Thu, 16 Apr 2026 09:53:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 47f61e2..ccb44bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,14 +2,18 @@ FROM registry.bjzgzp.com:4433/library/python3.12:base WORKDIR /app -RUN apt-get update && apt-get install -y --no-install-recommends \ +ARG APT_MIRROR=mirrors.tuna.tsinghua.edu.cn +ARG PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple + +RUN sed -i "s|deb.debian.org|${APT_MIRROR}|g; s|security.debian.org|${APT_MIRROR}|g" /etc/apt/sources.list.d/debian.sources \ + && apt-get update && apt-get install -y --no-install-recommends \ libgl1 \ libglib2.0-0 \ curl \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt +RUN pip install --no-cache-dir -i "${PIP_INDEX_URL}" -r requirements.txt COPY . . From 15adab58971942f300760c9d4f62e73d87c156b2 Mon Sep 17 00:00:00 2001 From: zjw <2956131242@qq.com> Date: Thu, 16 Apr 2026 10:02:13 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ccb44bf..5a237f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,6 @@ RUN pip install --no-cache-dir -i "${PIP_INDEX_URL}" -r requirements.txt COPY . . -EXPOSE 8000 +EXPOSE 18000 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "18000"]