ci: dockerise l'API + connexion DB et CORS configurables par env
- config.py: connexion SQL via DB_* (driver 18, auth SQL), fallback Windows local - main.py: origines CORS via CORS_ORIGINS - Dockerfile (python 3.12 + msodbcsql18) + workflow Gitea Actions (build/push image)
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
# API Data Sentinel — FastAPI + pyodbc (ODBC Driver 18 pour SQL Server).
|
||||
FROM python:3.12-slim
|
||||
|
||||
# Pilote Microsoft ODBC 18 (le 17 n'est plus packagé sur Debian 12 / bookworm).
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl gnupg ca-certificates apt-transport-https \
|
||||
&& curl -sSL https://packages.microsoft.com/keys/microsoft.asc \
|
||||
| gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg \
|
||||
&& echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/debian/12/prod bookworm main" \
|
||||
> /etc/apt/sources.list.d/mssql-release.list \
|
||||
&& apt-get update \
|
||||
&& ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8000
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
Reference in New Issue
Block a user