-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile-7.2-sqlsrv
54 lines (50 loc) · 2.59 KB
/
Dockerfile-7.2-sqlsrv
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM edyan/php:7.2
ARG ACCEPT_EULA=Y
ARG MS_REMOTE_PACKAGE=https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
ARG MS_LOCAL_PACKAGE=/tmp/packages-microsoft-prod.deb
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq && \
apt-get install -qq -y curl gnupg && \
curl $MS_REMOTE_PACKAGE --output $MS_LOCAL_PACKAGE && \
dpkg -i $MS_LOCAL_PACKAGE && \
apt-get update -qq && \
apt-get install -qq -y \
# To keep
msodbcsql17 mssql-tools unixodbc php7.2-sybase \
# remove later
unixodbc-dev php-pear php7.2-dev \
gcc g++ build-essential && \
# sqlsrv from PECL
pecl channel-update pecl.php.net && \
# Compile
pecl -q install sqlsrv-5.8.1 pdo_sqlsrv-5.8.1 && \
# Activate
echo "extension=pdo_sqlsrv.so" > /etc/php/current/mods-available/pdo_sqlsrv.ini && \
echo "extension=sqlsrv.so" > /etc/php/current/mods-available/sqlsrv.ini && \
phpenmod pdo_sqlsrv sqlsrv && \
# Remove useless packages / files
apt-get purge -qq --autoremove -y curl gnupg unixodbc-dev php-pear php7.2-dev gcc g++ build-essential && \
# I need that to make it work
apt-get install -qq -y libssl1.0 && \
# Clean
apt-get autoremove -qq -y && \
apt-get autoclean -qq && \
apt-get clean -qq && \
# Empty some directories from all files and hidden files
rm -rf /build /tmp/* /usr/share/php/docs /usr/share/php/tests && \
find /root /var/lib/apt/lists /usr/share/man /usr/share/doc /var/cache /var/log -type f -delete
COPY tests/sqlsrv.php /root/test.php
# At the end as it changes everytime ;)
ARG BUILD_DATE
ARG DOCKER_TAG
ARG VCS_REF
LABEL maintainer="Emmanuel Dyan <[email protected]>" \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.name=${DOCKER_TAG} \
org.label-schema.description="Docker PHP Image based on Debian and including main modules" \
org.label-schema.url="https://cloud.docker.com/u/edyan/repository/docker/edyan/php" \
org.label-schema.vcs-url="https://github.com/edyan/docker-php" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.schema-version="1.0" \
org.label-schema.vendor="edyan" \
org.label-schema.docker.cmd="docker run -d --rm ${DOCKER_TAG}"