Spaces:
Running
Running
File size: 1,503 Bytes
53718a0 8a38f1d 53718a0 3babe92 d43ac1d 3babe92 deb6d34 3babe92 53718a0 3babe92 53718a0 3babe92 53718a0 3babe92 53718a0 5c60e96 |
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 |
# Use the official Python image from the Docker Hub
FROM python:3.10-slim
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Set environment variables for the cache directory (use a writable directory)
ENV TRANSFORMERS_CACHE=/home/user/.cache/huggingface
# Create and set the cache directory so the user can write to it
RUN mkdir -p /home/user/.cache/huggingface && chown -R user:user /home/user/.cache
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Upgrade pip to the latest version to avoid issues with outdated pip
RUN pip install --no-cache-dir --upgrade pip
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Download any necessary assets
RUN mkdir content
ADD --chown=user https://huggingface.co/datasets/manhteky123/LawVietnamese/resolve/main/data.csv content/data.csv
ADD --chown=user https://huggingface.co/datasets/manhteky123/LawVietnamese/resolve/main/faiss_index.bin content/faiss_index.bin
ADD --chown=user https://huggingface.co/datasets/manhteky123/LawVietnamese/resolve/main/vectors.npy content/vectors.npy
# Expose the port the app runs on
EXPOSE 5000
# Define the command to run the application
CMD ["python", "app.py"]
|