cdewind/semantic-search
0
1# Use the official Python 3.12 image2FROM python:3.123 4# Install required system packages for pyodbc and ODBC Driver 17 for SQL Server5RUN apt-get update && apt-get install -y \6 unixodbc \7 unixodbc-dev \8 odbcinst \9 libpq-dev \10 libsqlite3-dev \11 libssl-dev \12 curl \13 # Add Microsoft ODBC Driver repository and install the ODBC Driver14 gnupg2 \15 lsb-release \16 && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \17 && curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \18 && apt-get update \19 && ACCEPT_EULA=Y apt-get install -y msodbcsql17 \20 && rm -rf /var/lib/apt/lists/*21 22# Create a new user and group23RUN useradd -m appuser24 25ENV HOME=/home/appuser \26 PATH=/home/appuser/.local/bin:$PATH27 28# Set the working directory to the app folder29WORKDIR /app30 31# Copy the current directory contents into the container at /app32COPY . .33 34# Change ownership of the files to the new user35RUN chown -R appuser:appuser /app36 37# Switch to the non-root user38USER appuser39 40# Install Python dependencies41RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt42 43# Start the FastAPI app44CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]45 