prompt-search-engine / Dockerfile
supertskone's picture
Update Dockerfile
171bd4d verified
# Use an official Python runtime as a parent image
FROM python:3.12-slim
# Create a non-root user and switch to that user
RUN useradd -m -u 1000 user
# Set the home directory for the user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory for the new user
WORKDIR $HOME/app
# Change ownership of the app directory
COPY --chown=user . $HOME/app
# Switch to the new user
USER user
# Set the working directory
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install system dependencies
# RUN apt-get update && apt-get install -u 0 -y \
# git \
# && rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Set environment variable for Hugging Face cache
ENV TRANSFORMERS_CACHE=/app/cache
# Create the cache directory
RUN mkdir -p /app/cache/hub
RUN chmod -R 777 /app/cache
# LOCAL: Expose port 8501 for Streamlit and port 5000 for Flask
# EXPOSE 8501
# EXPOSE 5000
# HF SPACES:
# Expose the port for Streamlit
EXPOSE 7860
# Run data loading, backend, and frontend
# CMD ["sh", "-c", "python load_data.py & python run.py & streamlit run ui/app.py --server.port=7860 --server.address=0.0.0.0"]
CMD ["sh", "-c", "python load_data.py & python run.py & streamlit run ui/app.py --server.port=7860"]