FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime as base RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential python3-venv curl && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* RUN python3 -m venv /opt/myenv ENV PATH="/opt/myenv/bin:$PATH" RUN pip install --no-cache-dir Flask matplotlib scikit-learn transformers pandas sentence_transformers && \ pip install --no-cache-dir --upgrade setuptools wheel FROM base as build WORKDIR /app COPY . /app RUN chown -R www-data:www-data /app && chmod -R 755 /app EXPOSE 5000 CMD ["/opt/myenv/bin/python", "/app/api.py"]