forked from fabiang/docker-sqlcmd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (35 loc) · 1.87 KB
/
Dockerfile
File metadata and controls
40 lines (35 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
ARG UBUNTU_VERSION=24.04
FROM ubuntu:$UBUNTU_VERSION
# Check latest published version here: https://packages.microsoft.com/ubuntu/24.04/prod/pool/main/m/mssql-tools18/
ARG MSSQLTOOLS_VERSION=18.4.1.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 --show-error 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' /tmp/microsoft-prod.list > /etc/apt/sources.list.d/microsoft.list; \
rm /tmp/microsoft-prod.list; \
else \
mv /tmp/microsoft-prod.list /etc/apt/sources.list.d/microsoft.list; \
fi \
&& curl --fail --show-error https://packages.microsoft.com/keys/microsoft.asc | \
gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg \
\
&& apt-get -qqq update \
&& ACCEPT_EULA=Y apt-get install -y --no-install-recommends mssql-tools$MSSQLTOOLS_SUFFIX=$MSSQLTOOLS_VERSION unixodbc-dev \
&& apt-get autoremove -y && apt-get clean \
&& rm -rf /tmp/* /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"]