更改
This commit is contained in:
71
Dockerfile/python/lessie-sourcing-agents/Dockerfile
Normal file
71
Dockerfile/python/lessie-sourcing-agents/Dockerfile
Normal file
@@ -0,0 +1,71 @@
|
||||
FROM uswccr.ccs.tencentyun.com/lessie/python:3.12-slim AS builder
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /data/webapps/lessie_sourcing_agents
|
||||
|
||||
# Install build prerequisites required for native wheels, then remove leftover apt metadata.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
git \
|
||||
libomp-dev \
|
||||
libopenblas-dev \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN python -m pip install --no-cache-dir "uv"
|
||||
|
||||
COPY pyproject.toml uv.lock requirements.in requirements.txt ./
|
||||
|
||||
# RUN python -m uv venv --python /usr/local/bin/python /opt/venv && \
|
||||
# python -m uv pip install --python /opt/venv/bin/python --no-cache -r requirements.txt
|
||||
|
||||
ENV UV_PROJECT_ENVIRONMENT=/opt/venv
|
||||
|
||||
RUN python -m uv venv /opt/venv && \
|
||||
python -m uv sync --frozen --no-dev --python /usr/local/bin/python
|
||||
|
||||
FROM uswccr.ccs.tencentyun.com/lessie/python:3.12-slim AS runtime
|
||||
|
||||
ARG APP_PORT=8000
|
||||
|
||||
ENV APP_ENV=local \
|
||||
APP_PORT=${APP_PORT}
|
||||
|
||||
WORKDIR /data/webapps/lessie_sourcing_agents
|
||||
|
||||
# Runtime dependencies required by packages like faiss-cpu.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libgomp1 \
|
||||
libomp5 \
|
||||
libopenblas0 \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Bring in the pre-built virtual environment from the builder stage.
|
||||
COPY --from=builder /opt/venv /opt/venv
|
||||
|
||||
# Ship only the application sources in the runtime image.
|
||||
COPY . .
|
||||
|
||||
ENV PATH="/opt/venv/bin:${PATH}" \
|
||||
VIRTUAL_ENV="/opt/venv"
|
||||
|
||||
EXPOSE ${APP_PORT}
|
||||
|
||||
RUN mkdir -p /data/webapps/lessie_sourcing_agents/logs
|
||||
|
||||
COPY scripts/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
ENV LOG_DIR=/data/webapps/lessie_sourcing_agents/logs
|
||||
|
||||
VOLUME ["/data/webapps/lessie_sourcing_agents/logs"]
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
Reference in New Issue
Block a user