luojunhui 2 天之前
父節點
當前提交
da909bc843
共有 2 個文件被更改,包括 30 次插入9 次删除
  1. 18 9
      Dockerfile
  2. 12 0
      docker-compose.yml

+ 18 - 9
Dockerfile

@@ -1,14 +1,23 @@
-# 基础镜像
 FROM egs-registry.cn-hangzhou.cr.aliyuncs.com/egs/vllm:0.8.2-pytorch2.6-cu124-20250328
 
-# 设置工作目录
-WORKDIR /workspace
+WORKDIR /app
 
-# 如果需要复制宿主机上的模型,可以提前 COPY
-# COPY models /models
+ENV PYTHONDONTWRITEBYTECODE=1
+ENV PYTHONUNBUFFERED=1
+ENV PIP_DISABLE_PIP_VERSION_CHECK=on
+ENV TZ=Asia/Shanghai
 
-# 默认用 Python 启动 vLLM API Server
-ENTRYPOINT ["python", "-m", "vllm.entrypoints.openai.api_server"]
+RUN apt-get update && apt-get install -y curl gnupg ca-certificates \
+    && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
+    && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
+    && apt-get clean \
+    && rm -rf /var/lib/apt/lists/*
 
-# 默认参数(可以在 docker run 里覆盖)
-CMD ["--model", "/models/Qwen3-Embedding-0.6B", "--dtype", "float16"]
+COPY requirements.txt .
+RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
+
+COPY . .
+
+EXPOSE 8080
+
+CMD ["hypercorn", "task_app:app", "--config", "app_config.toml"]

+ 12 - 0
docker-compose.yml

@@ -0,0 +1,12 @@
+services:
+  app:
+    build:
+      context: .
+      dockerfile: Dockerfile
+    container_name: vector-server-app
+    ports:
+      - "8000:8000"
+    volumes:
+      - .:/app
+    environment:
+      - PYTHONUNBUFFERED=1