Skip to content

Commit

Permalink
ODBC driver
Browse files Browse the repository at this point in the history
  • Loading branch information
feeelin committed Mar 15, 2024
1 parent 38d96be commit 1325cdb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11
FROM python:3.11.8-alpine3.19

ADD odbcinst.ini /etc/odbcinst.ini
RUN apt-get update
Expand All @@ -20,6 +20,9 @@ RUN source venv/bin/activate
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

COPY ./odbc.sh /web_django/
RUN ./odbc.sh

COPY ./requirements.txt /web_django/

RUN pip install --upgrade pip && pip install -r requirements.txt
Expand Down
26 changes: 26 additions & 0 deletions odbc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
case $(uname -m) in
x86_64) architecture="amd64" ;;
arm64) architecture="arm64" ;;
*) architecture="unsupported" ;;
esac
if [[ "unsupported" == "$architecture" ]];
then
echo "Alpine architecture $(uname -m) is not currently supported.";
exit;
fi

#Download the desired package(s)
curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_$architecture.apk
curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_$architecture.apk

#(Optional) Verify signature, if 'gpg' is missing install it using 'apk add gnupg':
curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_$architecture.sig
curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_$architecture.sig

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import -
gpg --verify msodbcsql18_18.3.2.1-1_$architecture.sig msodbcsql18_18.3.2.1-1_$architecture.apk
gpg --verify mssql-tools18_18.3.1.1-1_$architecture.sig mssql-tools18_18.3.1.1-1_$architecture.apk

#Install the package(s)
sudo apk add --allow-untrusted msodbcsql18_18.3.2.1-1_$architecture.apk
sudo apk add --allow-untrusted mssql-tools18_18.3.1.1-1_$architecture.apk

0 comments on commit 1325cdb

Please sign in to comment.