Merge remote-tracking branch 'origin/main'

This commit is contained in:
ageerle
2025-03-18 14:01:02 +08:00
3 changed files with 22 additions and 11 deletions

View File

@@ -1,21 +1,26 @@
# 使用官方 Python 作为基础镜像
FROM python:3.8-slim
# 使用 Python 3.8 slim 作为基础镜像(轻量稳定)
FROM python:3.10
# 设置工作目录为 /app
# 设置工作目录
WORKDIR /app
# 复制当前目录下的所有文件到 Docker 容器的 /app 目录
# 复制所有文件到容器
COPY . /app
# 安装应用依赖
RUN pip install --no-cache-dir -r requirements.txt
# 更新 pip 并安装 wheel避免依赖问题
RUN pip install --upgrade pip wheel
# 使用阿里云 PyPI 镜像安装依赖,并添加 trusted-host
RUN pip install -i https://mirrors.aliyun.com/pypi/simple \
--trusted-host mirrors.aliyun.com \
--no-cache-dir -r requirements.txt
# 暴露 Flask 应用使用的端口
# 暴露 Flask 端口
EXPOSE 5000
# 设置环境变量
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
# 启动 Flask 应用
# 运行 Flask
CMD ["flask", "run", "--host=0.0.0.0"]

View File

@@ -0,0 +1,4 @@
1.下载镜像
docker pull registry.cn-hangzhou.aliyuncs.com/hejh-docker/localmodel:0.1.1
2. 启动
docker run -p 5000:5000 <imageId>

View File

@@ -1,3 +1,5 @@
Flask==2.0.3
sentence-transformers==2.2.0
scikit-learn==0.24.2
Flask==3.1.0
sentence-transformers==3.4.1
scikit-learn==1.6.1
werkzeug>=3.1