ajnjdnjpek / Dockerfile
Adieee5's picture
Update Dockerfile
a515aee verified
FROM python:3.9
# Create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Copy and install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Install system dependencies and build tools
USER root
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-venv \
wget \
build-essential \
libsqlite3-dev
# Install newer SQLite version
WORKDIR /tmp
RUN wget https://www.sqlite.org/2023/sqlite-autoconf-3410200.tar.gz \
&& tar -xvf sqlite-autoconf-3410200.tar.gz \
&& cd sqlite-autoconf-3410200 \
&& ./configure \
&& make \
&& make install
# Update library path to use the new SQLite
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
RUN mkdir -p /app/static/chroma_store && chown -R user:user /app/static/chroma_store
# Go back to non-root user and app directory
USER user
WORKDIR /app
# Copy the app source code
COPY --chown=user . /app
# Expose port 7860 for the application
EXPOSE 7860
# Start the app using waitress
CMD ["python", "-m", "waitress", "--listen=0.0.0.0:7860", "app:app"]
# python -m waitress --listen=0.0.0.0:7860 app:app