diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh index 210c1fe..b6a9950 100644 --- a/.docker/entrypoint.sh +++ b/.docker/entrypoint.sh @@ -1,5 +1,13 @@ #!/bin/sh +# Install ODBC driver +./install_odbc.sh + # Start Dash and run in background echo "Starting Dash app..." +if [ -f "/app/env.sh" ]; then + . "/app/env.sh" + echo "env.sh has been sourced." +fi + poetry run gunicorn app:server -b 0.0.0.0:8000 diff --git a/.docker/install_odbc.sh b/.docker/install_odbc.sh new file mode 100755 index 0000000..0f8b7f1 --- /dev/null +++ b/.docker/install_odbc.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +apt-get update +apt-get install -y curl gnupg2 apt-transport-https + +# Debian 12 +curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg + +#Download appropriate package for the OS version +#Choose only ONE of the following, corresponding to your OS version + +#Debian 12 +curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list + +apt-get update +ACCEPT_EULA=Y apt-get install -y msodbcsql18 +# optional: for bcp and sqlcmd +ACCEPT_EULA=Y apt-get install -y mssql-tools18 +echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc +. ~/.bashrc +# optional: for unixODBC development headers +apt-get install -y unixodbc-dev +# optional: kerberos library for debian-slim distributions +apt-get install -y libgssapi-krb5-2 diff --git a/Dockerfile b/Dockerfile index 1b4dcf2..6bedef8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,7 +34,10 @@ COPY app/ app/ RUN poetry install --no-interaction --no-dev COPY ./.docker/entrypoint.sh /app/entrypoint.sh +COPY ./.docker/install_odbc.sh /app/install_odbc.sh + RUN chmod +x /app/entrypoint.sh +RUN chmod +x /app/install_odbc.sh WORKDIR /app