Spaces:
Running
on
T4
Running
on
T4
# Use an official Python runtime as a parent image | |
FROM nvidia/cuda:12.3.1-runtime-ubuntu22.04 | |
# Set Python to use unbuffered mode | |
ENV PYTHONUNBUFFERED=1 | |
ENV PATH="/var/www/.local/bin:${PATH}" | |
# Create a non-root user | |
RUN useradd -m -u 1000 -U -s /bin/bash myuser | |
# Install dependencies | |
RUN apt-get update && \ | |
apt-get install -y --no-install-recommends python3-pip python3-dev && \ | |
rm -rf /var/lib/apt/lists/* | |
# Set the working directory in the container | |
RUN mkdir /var/www | |
ENV HOME=/var/www | |
WORKDIR /var/www | |
# Change ownership of /var/www to the non-root user | |
RUN chown -R myuser:myuser /var/www | |
# Switch to the non-root user | |
USER myuser | |
# Copy the current directory contents into the container at /var/www | |
COPY . /var/www | |
# Install Python dependencies | |
RUN pip install --user -r requirements.txt | |
RUN pip install --user torch==1.12.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html | |
# RUN pip install --user ../whl/semantic_search_multistep_data/whl/torch-1.12.1+cu113-cp310-cp310-linux_x86_64.whl | |
# Expose the port | |
EXPOSE 7860 | |
RUN mkdir /var/www/logs | |
# Set environment variables | |
ENV GLOBAL_DATA_PATH="/var/www/legal_info_search_data/" \ | |
GLOBAL_TRANSACTION_MAPS_DATA_PATH="/var/www/transaction_maps_search_data/csv/карта_проводок_new.pkl" \ | |
ENABLE_LOGS= \ | |
LOGS_BASE_PATH="/data/logs" \ | |
GLOBAL_MODEL_PATH="/data/models/20240202_204910_ep8" \ | |
GLOBAL_TRANSACTION_MAPS_MODEL_PATH="intfloat/multilingual-e5-base" \ | |
LLM_API_ENDPOINT="http://llm-api-load-balancer:7860/completion" \ | |
ES_URL="http://172.16.33.44:9200" \ | |
ES_INDEX_NAME="nubu_index" | |
# Run fastapi_app.py when the container launches | |
CMD python3 -m uvicorn fastapi_app:app --host=0.0.0.0 --port=7860 |