forked from alexbrainman/odbc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unixodbc docker to test on linux
- Loading branch information
1 parent
1b0af60
commit bcbcb68
Showing
3 changed files
with
125 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
#set -e | ||
|
||
MSSQL_DRIVER_NAME="$1" | ||
MSSQL_CONTAINER_NAME="$2" | ||
DB_NAME="$3" | ||
MSSQL_SA_PASSWORD="$4" | ||
RACE="$5" | ||
|
||
pwd | ||
|
||
echo $PATH | ||
|
||
go version | ||
|
||
#sqlcmd -S localhost | ||
#sqlcmd -? | ||
|
||
# install freetds driver | ||
cat << EOF > tds.driver.template | ||
[FreeTDS] | ||
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so | ||
EOF | ||
odbcinst -i -d -f tds.driver.template | ||
cat tds.driver.template | ||
rm tds.driver.template | ||
|
||
# install microsoft driver | ||
odbcinst -q -d -n "${MSSQL_DRIVER_NAME}" > tds.driver.template | ||
odbcinst -i -d -f tds.driver.template | ||
cat tds.driver.template | ||
rm tds.driver.template | ||
|
||
echo "MSSQL_DRIVER_NAME=${MSSQL_DRIVER_NAME}" | ||
echo "MSSQL_CONTAINER_NAME=${MSSQL_CONTAINER_NAME}" | ||
echo "DB_NAME=${DB_NAME}" | ||
echo "MSSQL_SA_PASSWORD=${MSSQL_SA_PASSWORD}" | ||
echo "RACE=${RACE}" | ||
|
||
# add 1433 to mssrv parameter so we do not skip TestMSSQLReconnect | ||
|
||
go test -v \ | ||
-msdriver="${MSSQL_DRIVER_NAME}" \ | ||
-mssrv=${MSSQL_CONTAINER_NAME},1433 \ | ||
-msdb=${DB_NAME} \ | ||
-msuser=sa \ | ||
-mspass=${MSSQL_SA_PASSWORD} \ | ||
${RACE} \ | ||
-run=TestMSSQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM ubuntu:18.04 | ||
|
||
RUN apt update -y && apt upgrade -y && apt-get update | ||
RUN apt install -y curl python3.7 git python3-pip openjdk-8-jdk unixodbc-dev | ||
|
||
# Add SQL Server ODBC Driver 17 for Ubuntu 18.04 | ||
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - | ||
RUN curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list | ||
RUN apt-get update | ||
RUN ACCEPT_EULA=Y apt-get install -y --allow-unauthenticated msodbcsql17 | ||
RUN ACCEPT_EULA=Y apt-get install -y --allow-unauthenticated mssql-tools | ||
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile | ||
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc | ||
ENV PATH ${PATH}:/opt/mssql-tools/bin | ||
|
||
# download freetds driver | ||
RUN apt-get install -y unixodbc freetds-dev freetds-bin tdsodbc | ||
|
||
# download go tar | ||
RUN curl --location https://go.dev/dl/go1.20.linux-amd64.tar.gz | tar -C /usr/local -xzf - | ||
RUN echo 'export PATH="/usr/local/go/bin:$PATH"' >> ~/.bash_profile | ||
RUN echo 'export PATH="/usr/local/go/bin:$PATH"' >> ~/.bashrc | ||
ENV PATH /usr/local/go/bin:${PATH} | ||
|
||
WORKDIR /src | ||
|
||
#COPY mssqltest.sh / | ||
#RUN chmod +x /mssqltest.sh | ||
#ENTRYPOINT ["sh","/mssqltest.sh"] | ||
#ENTRYPOINT ["sh"] | ||
CMD ["sh"] |