diff --git a/Dockerfile b/Dockerfile index c884331..c567c07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,8 @@ ENV CONTAINER_USER="analyticalplatform" \ KUBECTL_VERSION="1.29.10" \ HELM_VERSION="3.16.2" \ CLOUD_PLATFORM_CLI_VERSION="1.37.12" \ + MICROSOFT_SQL_ODBC_VERSION="18.4.1.1-1" \ + MICROSOFT_SQL_TOOLS_VERSION="18.4.1.1-1" \ CUDA_VERSION="12.6.1" \ NVIDIA_DISABLE_REQUIRE="true" \ NVIDIA_CUDA_CUDART_VERSION="12.6.77-1" \ @@ -34,7 +36,7 @@ ENV CONTAINER_USER="analyticalplatform" \ NVIDIA_VISIBLE_DEVICES="all" \ NVIDIA_DRIVER_CAPABILITIES="compute,utility" \ LD_LIBRARY_PATH="/usr/local/nvidia/lib:/usr/local/nvidia/lib64" \ - PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/opt/conda/bin:/home/analyticalplatform/.local/bin:${PATH}" + PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/opt/conda/bin:/home/analyticalplatform/.local/bin:/opt/mssql-tools18/bin:${PATH}" SHELL ["/bin/bash", "-e", "-u", "-o", "pipefail", "-c"] @@ -320,5 +322,28 @@ install --owner nobody --group nogroup --mode 0755 cloud-platform /usr/local/bin rm --force --recursive cloud-platform LICENSE README.md completions cloud-platform-cli.tar.gz EOF +# Microsoft SQL ODBC and Tools +RUN < /etc/apt/sources.list.d/mssql-release.list + +apt-get update --yes + +ACCEPT_EULA=Y apt-get install --yes \ + "msodbcsql18=${MICROSOFT_SQL_ODBC_VERSION}" \ + "mssql-tools18=${MICROSOFT_SQL_TOOLS_VERSION}" + +apt-get clean --yes + +rm --force --recursive /var/lib/apt/lists/* microsoft.asc microsoft-prod.gpg +EOF + USER ${CONTAINER_USER} WORKDIR /home/${CONTAINER_USER} diff --git a/README.md b/README.md index 49d76b2..7b46201 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ This image is built on Ubuntu 24.04 LTS and includes the following software: - [Cloud Platform CLI](https://github.com/ministryofjustice/cloud-platform-cli) +- [Microsoft ODBC driver for SQL Server](https://learn.microsoft.com/en-us/sql/connect/odbc/microsoft-odbc-driver-for-sql-server) + ## Running Locally ### Build @@ -204,6 +206,34 @@ Releases for Helm are maintained on [GitHub](https://github.com/helm/helm/releas Releases for Cloud Platform CLI are maintained on [GitHub](https://github.com/ministryofjustice/cloud-platform-cli/releases). +### Microsoft ODBC driver for SQL Server + +The latest version of Microsoft ODBC driver for SQL Server can be obtained by running: + +```bash +docker run -it --rm --platform linux/amd64 public.ecr.aws/ubuntu/ubuntu:24.04 + +apt-get update --yes + +apt-get install --yes curl gpg + +curl --location --fail-with-body \ + "https://packages.microsoft.com/keys/microsoft.asc" \ + --output microsoft.asc + +cat microsoft.asc | gpg --dearmor --output microsoft-prod.gpg + +install -D --owner root --group root --mode 644 microsoft-prod.gpg /usr/share/keyrings/microsoft-prod.gpg + +echo "deb [arch=amd64,arm64,armhf signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/ubuntu/24.04/prod noble main" > /etc/apt/sources.list.d/mssql-release.list + +apt-get update --yes + +apt-cache policy msodbcsql18 + +apt-cache policy mssql-tools18 +``` + ## Maintenance Maintenance of this component is scheduled in this [workflow](https://github.com/ministryofjustice/analytical-platform/blob/main/.github/workflows/schedule-issue-cloud-development-environment-base.yml), which generates a maintenance ticket as per this [example](https://github.com/ministryofjustice/analytical-platform/issues/5905). diff --git a/test/container-structure-test.yml b/test/container-structure-test.yml index 6e3c556..c852d48 100644 --- a/test/container-structure-test.yml +++ b/test/container-structure-test.yml @@ -114,6 +114,11 @@ commandTests: args: ["--version"] expectedOutput: ["0.8.0"] + - name: "sqlcmd" + command: "sqlcmd" + args: ["-?"] + expectedOutput: ["Version 18.4.0001.1 Linux"] + fileExistenceTests: - name: "/opt/analytical-platform" path: "/opt/analytical-platform" @@ -188,6 +193,10 @@ fileExistenceTests: path: "/usr/local/cuda/lib64/libcudart.so.12" shouldExist: true + - name: "/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.4.so.1.1" + path: "/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.4.so.1.1" + shouldExist: true + metadataTest: user: "analyticalplatform"