Fix Docker build on 24.04 #309
Workflow file for this run
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
ARG UBUNTU_VERSION=22.04 | ||
FROM ubuntu:$UBUNTU_VERSION | ||
ARG MSSQLTOOLS_VERSION=18.2.1.1 | ||
# Microsoft decided to have a suffix for newer versions of mssql-tools, e.g. mssql-tools18 | ||
ARG MSSQLTOOLS_SUFFIX=18 | ||
# and also the path changed on newer versions. It's a mess. | ||
ARG MSSQLTOOLS_PATH=/opt/mssql-tools18 | ||
ENV PATH=$MSSQLTOOLS_PATH/bin:$PATH | ||
RUN apt-get -qqq update \ | ||
&& apt-get install -y curl apt-transport-https locales gnupg2 \ | ||
# Helper command to convert \r\n to \n, | ||
# since sqlcmd prints Windows line endings | ||
dos2unix \ | ||
&& locale-gen "en_US.UTF-8" \ | ||
\ | ||
&& export `grep "VERSION_ID" /etc/os-release | sed -e 's/^VERSION_ID=\"/VERSION_ID=/' -e 's/\"$//'` \ | ||
&& mkdir -p /usr/share/keyrings \ | ||
&& curl --fail https://packages.microsoft.com/config/ubuntu/$VERSION_ID/prod.list \ | ||
-o /tmp/microsoft-prod.list | \ | ||
if ! grep -q "signed-by=" /tmp/microsoft-prod.list; then \ | ||
sed -E 's#deb\s+\[#deb [signed-by=/usr/share/keyrings/microsoft-prod.gpg #; t; q1' | \ | ||
fi \ | ||
&& mv /tmp/microsoft-prod.list /etc/apt/sources.list.d/microsoft.list \ | ||
&& cat /etc/apt/sources.list.d/microsoft.list \ | ||
&& curl --fail https://packages.microsoft.com/keys/microsoft.asc | \ | ||
gpg --verbose --yes --no-tty --batch --dearmor -o /usr/share/keyrings/microsoft-prod.gpg \ | ||
\ | ||
&& apt-get -qqq update \ | ||
&& ACCEPT_EULA=Y apt-get install -y mssql-tools$MSSQLTOOLS_SUFFIX=$MSSQLTOOLS_VERSION unixodbc-dev \ | ||
&& apt-get remove -y curl apt-transport-https gnupg2 \ | ||
&& rm -f /etc/apt/sources.list.d/msprod.list \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
## should be set after locale was generated, overwise triggers warnings | ||
ENV LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8" LC_ALL="en_US.UTF-8" | ||
ENTRYPOINT ["sqlcmd"] |