-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile-7.1-sqlsrv
48 lines (44 loc) · 2.53 KB
/
Dockerfile-7.1-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
FROM edyan/php:7.1
ARG ACCEPT_EULA=Y
ARG DEBIAN_FRONTEND=noninteractive
RUN curl -sSLo /etc/apt/trusted.gpg.d/microsoft.asc https://packages.microsoft.com/keys/microsoft.asc && \
echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/22.04/prod/ jammy main" > /etc/apt/sources.list.d/mssql.list && \
apt-get update -qq && \
apt-get install -qq -y \
msodbcsql17 mssql-tools unixodbc unixodbc-dev php-pear php7.1-dev php7.1-sybase \
gcc g++ build-essential && \
# sqlsrv from PECL
pecl channel-update pecl.php.net && \
# Compile
pecl -q install sqlsrv-5.6.1 pdo_sqlsrv-5.6.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 files installed for other PHP Versions
rm -rf /usr/lib/php/20131226 /usr/lib/php/20151012 /usr/lib/php/20170718 && \
rm -rf /etc/php/5.6 /etc/php/7.0 /etc/php/7.2 && \
# Remove useless packages / files
apt-get purge -qq --autoremove -y curl gnupg unixodbc-dev php-pear php7.1-dev gcc g++ build-essential && \
# 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}"