wangdongxu

jira:NYJ-1460 desc:添加dockerfile

# Git
.git
.gitignore
# IDE
.idea
.vscode
*.swp
*.swo
# Python
__pycache__
*.py[cod]
*$py.class
*.so
.Python
.venv
venv/
# Cache
.ruff_cache
.mypy_cache
.pytest_cache
.cache
# Logs
logs/
*.log
# Docker
dockerfiles/
Dockerfile
.dockerignore
... ...
FROM aigc-embedding-service-base:latest
ENV PROJECT_ROOT=/app ENV=docker
FROM python:3.12-slim
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai PROJECT_ROOT=/app ENV=docker APP_LOG_TYPE=file,console
# 使用 Debian 的阿里云镜像
RUN echo "deb http://mirrors.aliyun.com/debian/ bookworm main contrib non-free" > /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free" >> /etc/apt/sources.list
# 安装系统依赖
RUN apt update && apt install -y --no-install-recommends gcc curl vim && rm -rf /var/lib/apt/lists/*
# 安装uv工具
RUN pip install --no-cache-dir uv
WORKDIR /app
COPY app/ ./app/
COPY . .
RUN uv pip install --system --no-cache ".[es,postgres]"
EXPOSE 8000
CMD ["python", "main.py"]
CMD ["python", "main.py"]
\ No newline at end of file
... ...
FROM baselib/aigc-embedding-service:base26402
ENV PROJECT_ROOT=/app ENV=docker APP_LOG_TYPE=file,console
WORKDIR /app
# 复制代码文件
COPY . .
EXPOSE 8000
CMD ["python", "main.py"]
... ...
... ... @@ -4,16 +4,10 @@ FROM python:3.12-slim
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai
RUN cat > /etc/apt/sources.list <<EOF
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
EOF
# 使用 Debian 的阿里云镜像
RUN echo "deb http://mirrors.aliyun.com/debian/ bookworm main contrib non-free" > /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free" >> /etc/apt/sources.list
# 安装系统依赖
RUN apt-get update && apt-get install -y --no-install-recommends gcc curl vim && rm -rf /var/lib/apt/lists/*
... ... @@ -21,8 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends gcc curl vim &&
# 安装uv工具
RUN pip install --no-cache-dir uv
WORKDIR /app
# 复制依赖文件
COPY ../pyproject.toml uv.lock ./
# 使用uv安装项目依赖(包含es和postgres可选依赖)
RUN uv pip install --system --no-cache -e ".[es,postgres]"
\ No newline at end of file
# 复制依赖文件(从构建上下文根目录复制)
COPY pyproject.toml uv.lock ./
RUN uv pip install --system --no-cache ".[es,postgres]"
\ No newline at end of file
... ...
import os
from pathlib import Path
os.environ['PROJECT_ROOT'] = Path(__file__).parent.absolute().as_posix()
from aabd.base.patched_logging import set_global_logger, get_logger
if not os.environ.get("PROJECT_ROOT"):
os.environ['PROJECT_ROOT'] = Path(__file__).parent.absolute().as_posix()
from aabd.base.patched_logging import init_logging, get_logger
set_global_logger()
init_logging()
logger = get_logger(__name__)
from contextlib import asynccontextmanager
... ...
... ... @@ -11,6 +11,7 @@ dependencies = [
"path==17.1.1",
"omegaconf==2.3.0",
"elasticsearch>=9.3.0",
"packaging==26.0",
]
[project.optional-dependencies]
... ... @@ -50,3 +51,6 @@ testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
[tool.setuptools]
packages = []
... ...