Oviya commited on
Commit
cef089a
·
1 Parent(s): 491a6e1

Fix Dockerfile: use keyring, install msodbcsql17

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -12
Dockerfile CHANGED
@@ -1,22 +1,25 @@
1
  FROM python:3.11-slim
2
  ENV DEBIAN_FRONTEND=noninteractive
3
 
4
- # ODBC + Microsoft SQL Server ODBC driver 17 (matches your connection string)
5
- RUN apt-get update && apt-get install -y --no-install-recommends \
6
- curl gnupg2 apt-transport-https unixodbc unixodbc-dev \
7
- && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
8
- && echo "deb [arch=amd64] https://packages.microsoft.com/debian/12/prod bookworm main" > /etc/apt/sources.list.d/mssql-release.list \
9
- && apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql17 \
10
- && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
11
 
12
  WORKDIR /app
13
  COPY requirements.txt /app/
14
  RUN pip install --no-cache-dir -r requirements.txt
15
  COPY . /app
16
 
17
- # Spaces expect your server on port 7860
18
  EXPOSE 7860
19
-
20
- # Your Flask app object is `app` in verification.py
21
- # app.run() will NOT execute because gunicorn imports the module.
22
- CMD ["gunicorn", "--workers", "2", "--threads", "4", "--timeout", "120", "-b", "0.0.0.0:7860", "verification:app"]
 
1
  FROM python:3.11-slim
2
  ENV DEBIAN_FRONTEND=noninteractive
3
 
4
+ # System deps + Microsoft key via keyring (apt-key is deprecated/absent)
5
+ RUN set -eux; \
6
+ apt-get update; \
7
+ apt-get install -y --no-install-recommends \
8
+ curl ca-certificates gnupg2 apt-transport-https \
9
+ unixodbc unixodbc-dev; \
10
+ mkdir -p /etc/apt/keyrings; \
11
+ curl -fsSL https://packages.microsoft.com/keys/microsoft.asc \
12
+ | gpg --dearmor -o /etc/apt/keyrings/microsoft.gpg; \
13
+ echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/debian/12/prod bookworm main" \
14
+ > /etc/apt/sources.list.d/mssql-release.list; \
15
+ apt-get update; \
16
+ ACCEPT_EULA=Y apt-get install -y msodbcsql17; \
17
+ rm -rf /var/lib/apt/lists/*
18
 
19
  WORKDIR /app
20
  COPY requirements.txt /app/
21
  RUN pip install --no-cache-dir -r requirements.txt
22
  COPY . /app
23
 
 
24
  EXPOSE 7860
25
+ CMD ["gunicorn","--workers","2","--threads","4","--timeout","120","-b","0.0.0.0:7860","verification:app"]