FROM python:3.10 RUN useradd -m -u 1000 user WORKDIR /app COPY --chown=user ./requirements.txt requirements.txt # install FreeTDS and dependencies RUN apt-get update \ && apt-get install unixodbc -y \ && apt-get install unixodbc-dev -y \ && apt-get install freetds-dev -y \ && apt-get install freetds-bin -y \ && apt-get install tdsodbc -y \ && apt-get install --reinstall build-essential -y RUN apt-get update && apt-get install -y git git-lfs ffmpeg libsm6 libxext6 cmake rsync libgl1-mesa-glx && rm -rf /var/lib/apt/lists/* && git lfs install RUN pip install --no-cache-dir "uvicorn>=0.14.0" spaces RUN mkdir -p .streamlit && git config --global core.excludesfile ~/.gitignore && echo ".streamlit" > ~/.gitignore # populate "ocbcinst.ini" as this is where ODBC driver config sits RUN echo "[FreeTDS]\n\ Description = FreeTDS Driver\n\ Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so\n\ Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so" >> /etc/odbcinst.ini RUN pip install --no-cache-dir --upgrade -r requirements.txt COPY --chown=user . /app # User USER user ENV HOME /home/user ENV PATH $HOME/.local/bin:$PATH EXPOSE 8501 ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501"]