Skip to content

Commit

Permalink
updated mssql setup
Browse files Browse the repository at this point in the history
  • Loading branch information
schmunk42 committed Jan 18, 2017
1 parent d6ff03b commit 4e4e5e4
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 5 deletions.
52 changes: 52 additions & 0 deletions Dockerfile-mssql
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM bylexus/apache-php7

# https://www.microsoft.com/en-us/sql-server/developer-get-started/php-ubuntu
RUN apt-get update
RUN apt-get install -y curl apt-transport-https

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

RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql
RUN apt-get install -y unixodbc-dev-utf16

RUN apt-get install -y php-dev
RUN pecl install sqlsrv pdo_sqlsrv

RUN echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/apache2/php.ini
RUN echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/apache2/php.ini
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

# TODO: temporary section --->
# Install system packages for composer (git)
RUN apt-get update && \
apt-get -y install \
git \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Register the COMPOSER_HOME environment variable
ENV COMPOSER_HOME /composer
# Add global binary directory to PATH and make sure to re-export it
ENV PATH /usr/local/bin:$PATH
# Allow Composer to be run as root
ENV COMPOSER_ALLOW_SUPERUSER 1
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--filename=composer.phar \
--install-dir=/usr/local/bin
# TODO: <--- end


# Project source-code
WORKDIR /project
ADD composer.* /project/
RUN /usr/local/bin/composer.phar install --prefer-dist
ADD ./ /project

# https://github.com/Microsoft/msphpsql/issues/161
RUN apt-get install -y locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen
2 changes: 1 addition & 1 deletion tests/data/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
'fixture' => __DIR__ . '/sqlite.sql',
],
'sqlsrv' => [
'dsn' => 'sqlsrv:Server=mssql;Database=dbo',
'dsn' => 'sqlsrv:Server=mssql;Database=yii2test',
'username' => 'sa',
'password' => 'Microsoft-12345',
'fixture' => __DIR__ . '/mssql.sql',
Expand Down
1 change: 1 addition & 0 deletions tests/docker/mssql/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=yii2testmssql
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ services:

php:
#image: ppoffice/apache-php-mssql-odbc
image: nsidhaye/msphpsql
build:
context: ../../..
dockerfile: Dockerfile-mssql
entrypoint: ['bash']
ports:
- 80
volumes:
- ../:/app
#volumes:
# - ../../..:/project
depends_on:
- mssql

mssql:
image: microsoft/mssql-server-linux
#image: microsoft/mssql-server-windows
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=Microsoft-12345
Expand All @@ -22,4 +25,4 @@ services:
image: tsgkadot/mssql-tools
entrypoint: bash
volumes:
- ../:/app
- ../../..:/project

0 comments on commit 4e4e5e4

Please sign in to comment.