Spaces:
Sleeping
Sleeping
FROM python:3.9 | |
# Set up working directory and install dependencies | |
WORKDIR /code | |
COPY ./requirements.txt /code/requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
# Create a new user and set permissions | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH \ | |
HF_HOME=/home/user/.cache/huggingface \ | |
OPENAI_API_KEY=your_openai_api_key_here | |
WORKDIR $HOME/app | |
# Copy the rest of the application code into the container | |
COPY --chown=user . $HOME/app | |
# Ensure the cache directory has proper permissions | |
RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME | |
# Expose the port the app runs on | |
EXPOSE 8000 | |
# Run the application using uvicorn | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] | |