# Use Python as the base image FROM python:3.10 # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ unixodbc \ unixodbc-dev \ apt-transport-https \ gnupg \ libodbc1 \ odbcinst \ libodbc2 # Add Microsoft repository and install ODBC Driver 18 RUN curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc RUN echo "deb [arch=amd64] https://packages.microsoft.com/debian/11/prod bookworm main" > /etc/apt/sources.list.d/mssql-release.list RUN apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql18 # Manually create a symbolic link to fix libodbc.so.2 missing error RUN ln -s /usr/lib/x86_64-linux-gnu/libodbc.so /usr/lib/x86_64-linux-gnu/libodbc.so.2 # Verify ODBC installation RUN ls -l /usr/lib/x86_64-linux-gnu/ | grep odbc RUN odbcinst -q -d # Set working directory WORKDIR /home/user/app # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Force reinstall pyodbc inside the container RUN pip uninstall -y pyodbc && pip install --no-cache-dir pyodbc # Copy application code COPY . . # Run the Streamlit app CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]