generated from yiisoft/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
88 lines (65 loc) · 3.49 KB
/
Dockerfile
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
FROM composer/composer:latest-bin AS composer
FROM php:8.3-cli
# System packages
RUN apt-get update && apt-get install -y \
unzip \
# PostgreSQL
libpq-dev \
# MSSQL
apt-transport-https \
gnupg2 \
libpng-dev \
# Oracle
libaio1 && \
rm -rf /var/lib/apt/lists/*
# MSSQL dependencies
ENV ACCEPT_EULA=Y
# Install prerequisites for the sqlsrv and pdo_sqlsrv PHP extensions.
# Some packages are pinned with lower priority to prevent build issues due to package conflicts.
# Link: https://github.com/microsoft/linux-package-repositories/issues/39
RUN 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 "Package: unixodbc\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \
&& echo "Package: unixodbc-dev\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \
&& echo "Package: libodbc1:amd64\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \
&& echo "Package: odbcinst\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \
&& echo "Package: odbcinst1debian2:amd64\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 100\n" >> /etc/apt/preferences.d/microsoft \
&& apt-get update \
&& apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \
&& rm -rf /var/lib/apt/lists/*
# Oracle dependencies
RUN cd /tmp && curl -L https://download.oracle.com/otn_software/linux/instantclient/2350000/instantclient-basic-linux.x64-23.5.0.24.07.zip -O
RUN cd /tmp && curl -L https://download.oracle.com/otn_software/linux/instantclient/2350000/instantclient-sdk-linux.x64-23.5.0.24.07.zip -O
RUN cd /tmp && curl -L https://download.oracle.com/otn_software/linux/instantclient/2350000/instantclient-sqlplus-linux.x64-23.5.0.24.07.zip -O
RUN unzip /tmp/instantclient-basic-linux.x64-23.5.0.24.07.zip -d /usr/local/
RUN unzip -o /tmp/instantclient-sdk-linux.x64-23.5.0.24.07.zip -d /usr/local/
RUN unzip -o /tmp/instantclient-sqlplus-linux.x64-23.5.0.24.07.zip -d /usr/local/
RUN ln -s /usr/local/instantclient_23_5 /usr/local/instantclient
# Fixes error "libnnz19.so: cannot open shared object file: No such file or directory"
RUN ln -s /usr/local/instantclient/lib* /usr/lib
RUN ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus
RUN echo 'export LD_LIBRARY_PATH="/usr/local/instantclient"' >> /root/.bashrc
RUN echo 'umask 002' >> /root/.bashrc
# PHP extensions
RUN docker-php-ext-install \
pdo_mysql \
pdo_pgsql \
# For Psalm, to make use of JIT for a 20%+ performance boost.
opcache
RUN echo 'instantclient,/usr/local/instantclient' | pecl install oci8
RUN echo "extension=oci8.so" > /usr/local/etc/php/conf.d/php-oci8.ini
RUN echo 'instantclient,/usr/local/instantclient' | pecl install pdo_oci
RUN echo "extension=pdo_oci.so" > /usr/local/etc/php/conf.d/php-pdo-oci.ini
RUN pecl install sqlsrv
RUN printf "; priority=20\nextension=sqlsrv.so\n" > /usr/local/etc/php/conf.d/php-sqlsrv.ini
RUN pecl install pdo_sqlsrv
RUN printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /usr/local/etc/php/conf.d/php-pdo-sqlsrv.ini
# For code coverage (mutation testing)
RUN pecl install pcov && docker-php-ext-enable pcov
# Composer
COPY --from=composer /composer /usr/bin/composer
# Code
COPY . /code
WORKDIR /code
# PHP packages
RUN composer install