Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impr(optimization): Optimized 9 Dockerfiles, enhanced readability (@Ilolm) #904

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions linux/mssql-tools/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ FROM alpine

LABEL maintainer="SQL Server Engineering Team"

RUN apk add curl gnupg
RUN echo "Installing needed software"
&& apk update --no-cache \
&& add --no-cache curl gnupg && \

#Download the desired package(s)
RUN curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/msodbcsql18_18.0.1.1-1_amd64.apk \
&& curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/mssql-tools18_18.0.1.1-1_amd64.apk
echo "Download the desired package(s)" \
&& curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/msodbcsql18_18.0.1.1-1_amd64.apk \
&& curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/mssql-tools18_18.0.1.1-1_amd64.apk && \

echo "(Optional) Verify signature, if 'gpg' is missing install it using 'apk add gnupg':" \
&& curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/msodbcsql18_18.0.1.1-1_amd64.sig \
&& curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/mssql-tools18_18.0.1.1-1_amd64.sig && \

#(Optional) Verify signature, if 'gpg' is missing install it using 'apk add gnupg':
RUN curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/msodbcsql18_18.0.1.1-1_amd64.sig \
&& curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/mssql-tools18_18.0.1.1-1_amd64.sig

RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \
echo "Verifying signature." \
&& curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - \
&& gpg --verify msodbcsql18_18.0.1.1-1_amd64.sig msodbcsql18_18.0.1.1-1_amd64.apk \
&& gpg --verify mssql-tools18_18.0.1.1-1_amd64.sig mssql-tools18_18.0.1.1-1_amd64.apk

&& gpg --verify mssql-tools18_18.0.1.1-1_amd64.sig mssql-tools18_18.0.1.1-1_amd64.apk && \

#Install the package(s)
RUN apk add --allow-untrusted msodbcsql18_18.0.1.1-1_amd64.apk \
&& apk add --allow-untrusted mssql-tools18_18.0.1.1-1_amd64.apk \
echo "Installing the package(s)" \
&& apk add --no-cache --allow-untrusted msodbcsql18_18.0.1.1-1_amd64.apk \
&& apk add --no-cache --allow-untrusted mssql-tools18_18.0.1.1-1_amd64.apk \
&& rm -f msodbcsql18_18.0.1.1-1_amd64.apk mssql-tools18_18.0.1.1-1_amd64.apk


CMD /bin/bash
CMD ["/bin/bash"]
43 changes: 23 additions & 20 deletions linux/mssql-tools/Dockerfile.debian11
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@ FROM debian:11

LABEL maintainer="SQL Server Engineering Team"

# apt-get and system utilities
RUN apt-get update && apt-get install -y \
curl apt-transport-https debconf-utils gnupg2

# adding custom MS repository
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list

# install SQL Server drivers and tools
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
RUN /bin/bash -c "source ~/.bashrc"



RUN apt-get -y install locales \
RUN echo "Installing system utilities"
&& apt-get update \
&& apt-get install -y curl apt-transport-https debconf-utils gnupg2 && \

echo "adding custom MS repository" \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list && \

echo "installing SQL Server drivers and tools" \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18 \
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc \
&& /bin/bash -c "source ~/.bashrc" && \

echo "Configuring locales" \
&& apt-get -y install locales \
&& rm -rf /var/lib/apt/lists/* \
&& locale-gen en_US.UTF-8 \
&& localedef -i en_US -f UTF-8 en_US.UTF-8 && \

echo "Cleaning cache" \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8
RUN localedef -i en_US -f UTF-8 en_US.UTF-8


CMD /bin/bash
CMD ["/bin/bash"]
16 changes: 8 additions & 8 deletions linux/mssql-tools/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ FROM redhat/ubi9

LABEL maintainer="SQL Server Engineering Team"

# adding custom MS repository
RUN yum install -y https://packages.microsoft.com/config/rhel/9.0/packages-microsoft-prod.rpm
RUN echo "Adding custom MS repository" \
&& yum install -y https://packages.microsoft.com/config/rhel/9.0/packages-microsoft-prod.rpm && \

# install SQL Server drivers and tools
RUN ACCEPT_EULA=Y dnf install -y msodbcsql18 mssql-tools18
echo "Installing SQL Server drivers and tools" \
&& ACCEPT_EULA=Y dnf install -y msodbcsql18 mssql-tools18 && \

# add the binary location to the $PATH
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
RUN /bin/bash -c "source ~/.bashrc"
echo "Adding the binary location to the $PATH" \
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc \
&& /bin/bash -c "source ~/.bashrc"

CMD /bin/bash
CMD ["/bin/bash"]
44 changes: 23 additions & 21 deletions linux/mssql-tools/Dockerfile.ubuntu2004
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@ FROM ubuntu:20.04

LABEL maintainer="SQL Server Engineering Team"

# apt-get and system utilities
RUN apt-get update && apt-get install -y \
curl apt-transport-https debconf-utils gnupg2

# adding custom MS repository
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list

# install SQL Server drivers and tools
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
RUN /bin/bash -c "source ~/.bashrc"



RUN apt-get -y install locales \
RUN echo "Installing system utilities" \
&& apt-get update \
&& apt-get install -y curl apt-transport-https debconf-utils gnupg2 && \

echo "Adding custom MS repository" \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && \

echo "Installing SQL Server drivers and tools" \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18 \
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc \
&& /bin/bash -c "source ~/.bashrc" && \

echo "Configuring locales" \
&& apt-get -y install locales \
&& rm -rf /var/lib/apt/lists/* \
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8 && \

echo "Cleaning cache" \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8



CMD /bin/bash
CMD ["/bin/bash"]
44 changes: 23 additions & 21 deletions linux/mssql-tools/Dockerfile.ubuntu2204
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@ FROM ubuntu:22.04

LABEL maintainer="SQL Server Engineering Team"

# apt-get and system utilities
RUN apt-get update && apt-get install -y \
curl apt-transport-https debconf-utils gnupg2

# adding custom MS repository
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list > /etc/apt/sources.list.d/mssql-release.list

# install SQL Server drivers and tools
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
RUN /bin/bash -c "source ~/.bashrc"



RUN apt-get -y install locales \
RUN echo "Installing system utilities" \
&& apt-get update \
&& apt-get install -y curl apt-transport-https debconf-utils gnupg2 && \

echo "Adding custom MS repository" \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && \

echo "Install SQL Server drivers and tools" \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18 \
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc \
&& /bin/bash -c "source ~/.bashrc" && \

echo "Configuring locales" \
&& apt-get -y install locales \
&& rm -rf /var/lib/apt/lists/* \
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8 && \

echo "Cleaning cache" \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8



CMD /bin/bash
CMD ["/bin/bash"]
66 changes: 36 additions & 30 deletions oss-drivers/msphpsql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,55 @@
# mssql-php-msphpsql
# PHP runtime with sqlservr and pdo_sqlsrv to connect to SQL Server
FROM ubuntu:16.04

MAINTAINER SQL Server Connectivity Team

# apt-get and system utilities
RUN apt-get update && apt-get install -y \
curl apt-utils apt-transport-https debconf-utils gcc build-essential g++-5\
&& rm -rf /var/lib/apt/lists/*
RUN echo "Installing system utilities" \
&& apt-get update \
&& apt-get install -y curl apt-utils apt-transport-https debconf-utils gcc build-essential g++-5 && \

# adding custom MS repository
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
echo "Adding custom MS repository \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && \

# install SQL Server drivers
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y unixodbc-dev msodbcsql
echo "Installing SQL Server drivers" \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y unixodbc-dev msodbcsql && \

# install SQL Server tools
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN /bin/bash -c "source ~/.bashrc"
echo "Installing SQL Server tools" \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y mssql-tools \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc \
&& /bin/bash -c "source ~/.bashrc" && \

# php libraries
RUN apt-get update && apt-get install -y \
php7.0 libapache2-mod-php7.0 mcrypt php7.0-mcrypt php-mbstring php-pear php7.0-dev \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
echo "Installing php libraries" \
&& apt-get update \
&& apt-get install -y php7.0 libapache2-mod-php7.0 mcrypt php7.0-mcrypt php-mbstring php-pear php7.0-dev --no-install-recommends && \

# install necessary locales
RUN apt-get install -y locales \
echo "Installing necessary locales" \
&& apt-get install -y locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen
&& locale-gen && \

echo "Installing SQL Server PHP connector module" \
&& pecl install sqlsrv pdo_sqlsrv && \

# install SQL Server PHP connector module
RUN pecl install sqlsrv pdo_sqlsrv
echo "Initial configuration of SQL Server PHP connector" \
&& echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/cli/php.ini \
&& echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/cli/php.ini && \

# initial configuration of SQL Server PHP connector
RUN echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/cli/php.ini
RUN echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/cli/php.ini
echo "Installing additional utilities" \
&& apt-get update \
&& apt-get install gettext nano vim -y && \

# install additional utilities
RUN apt-get update && apt-get install gettext nano vim -y
echo "Cleaning cache" \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* && \

# add sample code
# Adding sample code
RUN mkdir /sample
ADD . /sample

WORKDIR /sample

CMD /bin/bash ./entrypoint.sh
CMD /bin/bash ./entrypoint.sh
46 changes: 24 additions & 22 deletions oss-drivers/php-mssql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,34 @@
# PHP runtime with pdo_sqlsrv to connect to SQL Server
FROM ubuntu:16.04

# apt-get and system utilities
RUN apt-get update && apt-get install -y \
curl apt-utils apt-transport-https debconf-utils gcc build-essential g++-5\
&& rm -rf /var/lib/apt/lists/*
RUN echo "Installing system utilities" \
&& apt-get update \
&& apt-get install -y curl apt-utils apt-transport-https debconf-utils gcc build-essential g++-5 && \

# adding custom MS repository
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
echo "Adding custom MS repository" \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && \

# install SQL Server drivers
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y unixodbc-dev msodbcsql
echo "Installing SQL Server drivers" \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y unixodbc-dev msodbcsql && \

# php libraries
RUN apt-get update && apt-get install -y \
php7.0 libapache2-mod-php7.0 mcrypt php7.0-mcrypt php-mbstring php-pear php7.0-dev \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
echo "Installing php libraries" \
&& apt-get update \
&& apt-get install -y php7.0 libapache2-mod-php7.0 mcrypt php7.0-mcrypt php-mbstring php-pear php7.0-dev --no-install-recommends && \

# install necessary locales
RUN apt-get install -y locales \
echo "Installing necessary locales" \
&& apt-get install -y locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen
&& locale-gen && \

# install SQL Server PHP connector module
RUN pecl install sqlsrv pdo_sqlsrv
echo "Installing SQL Server PHP connector module" \
&& pecl install sqlsrv pdo_sqlsrv && \

# initial configuration of SQL Server PHP connector
RUN echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/cli/php.ini
RUN echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/cli/php.ini
echo "Initial configuration of SQL Server PHP connector" \
&& echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/cli/php.ini \
&& echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/cli/php.ini && \

echo "Cleaning cache" \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Loading