Skip to content

Instantly share code, notes, and snippets.

@peter279k
Last active March 19, 2021 18:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save peter279k/4e34947ff6dddd3377c0056163ea8495 to your computer and use it in GitHub Desktop.
Save peter279k/4e34947ff6dddd3377c0056163ea8495 to your computer and use it in GitHub Desktop.
This is Docker image about the PHP+MSSQL enviroment
# Install required packages
# MySQL to MSSQL http://www.sqlines.com/online
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-get install -y python-software-properties
RUN LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
RUN apt-get update
RUN apt-get install -y apt-transport-https apt-utils curl php7.1-cli php7.1-mysql php7.1-curl
RUN apt-get install -y php7.1-xml php7.1-dom php7.1-xsl php7.1-json php7.1-odbc php7.1-dev
RUN apt-get install -y libcurl3-openssl-dev
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/mssql-tools.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y mssql-tools
RUN apt-get install -y unixodbc-dev
RUN export PATH="$PATH:/opt/mssql-tools/bin"
RUN export PATH="$PATH:/opt/mssql-tools/bin"
RUN pecl config-set php_ini /etc/php/7.1/cli/php.ini
RUN pecl install sqlsrv
RUN pecl install pdo_sqlsrv
RUN echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/20-sqlsrv.ini
RUN echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini
ENTRYPOINT [ "bash" ]