File size: 1,272 Bytes
21a6949
 
 
 
 
 
 
 
 
5357ff6
 
af55c6c
 
21a6949
 
 
 
 
 
af55c6c
 
 
5357ff6
 
 
 
21a6949
 
 
 
 
 
 
af55c6c
 
 
21a6949
 
 
 
 
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
# 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"]