Spaces:
Running
Running
File size: 1,208 Bytes
80c3580 5f7211a 47da9fc 80c3580 e68f79c 80c3580 0213327 80c3580 e68f79c 5f7211a e68f79c 5f7211a e68f79c 5f7211a 80c3580 47da9fc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
FROM python:3.10-slim
# Add build argument
# ARG HUGGINGFACE_API_KEY
# ENV HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
# System dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements first for caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --force-reinstall 'https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_multi-backend-refactor/bitsandbytes-0.44.1.dev0-py3-none-manylinux_2_24_x86_64.whl'
# Copy project files
COPY . .
# # Environment variables
ENV PYTHONUNBUFFERED=1
# ENV HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
# HuggingFace login at container startup
RUN --mount=type=secret,id=HUGGINGFACE_API_KEY \
HUGGINGFACE_API_KEY=$(cat /run/secrets/HUGGINGFACE_API_KEY) && \
huggingface-cli login --token $HUGGINGFACE_API_KEY
# RUN mkdir -p ~/.huggingface && \
# echo "${HUGGINGFACE_API_KEY}" > ~/.huggingface/token && \
# huggingface-cli login --token ${HUGGINGFACE_API_KEY}
# Expose port
EXPOSE 7860
# Run the application
CMD ["python", "main.py"]
|