-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
166 lines (153 loc) · 5.42 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
FROM linc70j/php-swoole:2.0.0-beta
# Set Environment Variables
ENV DEBIAN_FRONTEND noninteractive
ARG INSTALL_SSH2=false
ARG INSTALL_SOAP=false
ARG INSTALL_XSL=false
ARG INSTALL_BCMATH=false
ARG INSTALL_IMAP=false
ARG INSTALL_IMAGICK=false
ARG INSTALL_MYSQLI=false
ARG INSTALL_MSSQL=false
ARG INSTALL_MONGO=false
ARG INSTALL_PGSQL=false
ARG INSTALL_SOCKETS=false
ARG INSTALL_RDKAFKA=false
ARG INSTALL_PHPREDIS=false
ARG INSTALL_NODE=false
ARG INSTALL_YARN=false
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
# SSH2:
if [ ${INSTALL_SSH2} = true ]; then \
apt-get -y install libssh2-1-dev && \
pecl install -a ssh2-1.1.2 && \
docker-php-ext-enable ssh2 \
;fi && \
# SOAP:
if [ ${INSTALL_SOAP} = true ]; then \
rm /etc/apt/preferences.d/no-debian-php && \
apt-get -y install libxml2-dev php-soap && \
docker-php-ext-install soap \
;fi && \
# XSL:
if [ ${INSTALL_XSL} = true ]; then \
apt-get -y install libxslt-dev && \
docker-php-ext-install xsl \
;fi && \
# BCMath:
if [ ${INSTALL_BCMATH} = true ]; then \
docker-php-ext-install bcmath \
;fi && \
# IMAP:
if [ ${INSTALL_IMAP} = true ]; then \
apt-get install -y libc-client-dev libkrb5-dev && \
docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
docker-php-ext-install imap \
;fi && \
# Imagick
if [ ${INSTALL_IMAGICK} = true ]; then \
apt-get install -y libmagickwand-dev imagemagick && \
pecl install imagick && \
docker-php-ext-enable imagick \
;fi && \
# MySQLi:
if [ ${INSTALL_MYSQLI} = true ]; then \
docker-php-ext-install pdo_mysql && \
docker-php-ext-install mysqli \
;fi && \
# MongoDB:
if [ ${INSTALL_MONGO} = true ]; then \
pecl install mongodb && \
docker-php-ext-enable mongodb \
;fi && \
# PGSql:
if [ ${INSTALL_PGSQL} = true ]; then \
docker-php-ext-install pdo_pgsql pgsql \
;fi && \
# SOCKETS:
if [ ${INSTALL_SOCKETS} = true ]; then \
docker-php-ext-install sockets \
;fi && \
# RDKAFKA:
if [ ${INSTALL_RDKAFKA} = true ]; then \
apt-get install -y librdkafka-dev && \
pecl install rdkafka && \
docker-php-ext-enable rdkafka \
;fi && \
# PHP REDIS EXTENSION:
if [ ${INSTALL_PHPREDIS} = true ]; then \
printf "\n" | pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis \
;fi && \
# Node:
if [ ${INSTALL_YARN} = true ]; then \
apt-get -y install nodejs yarn; \
else \
if [ ${INSTALL_NODE} = true ]; then \
apt-get -y install nodejs; \
fi \
;fi && \
# SQL SERVER:
set -eux; \
if [ ${INSTALL_MSSQL} = true ]; then \
# Add Microsoft repo for Microsoft ODBC Driver 13 for Linux
apt-get install -y apt-transport-https gnupg \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update -yqq \
# Install Dependencies
&& ACCEPT_EULA=Y apt-get install -y unixodbc unixodbc-dev libgss3 odbcinst msodbcsql17 locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
# link local aliases
&& ln -sfn /etc/locale.alias /usr/share/locale/locale.alias \
&& locale-gen \
# Install pdo_sqlsrv and sqlsrv from PECL. Replace pdo_sqlsrv-4.1.8preview with preferred version.
&& pecl install pdo_sqlsrv sqlsrv \
&& docker-php-ext-enable pdo_sqlsrv sqlsrv \
&& php -m | grep -q 'pdo_sqlsrv' \
&& php -m | grep -q 'sqlsrv' \
;fi && \
buildDeps='gcc make autoconf libc-dev pkg-config' && \
apt-get purge -y --auto-remove $buildDeps && \
apt-get clean && rm -rf /var/lib/apt/lists/*
#
#--------------------------------------------------------------------------
# Final Touch
#--------------------------------------------------------------------------
#
# Copy project
COPY ./ /var/www
USER root
RUN usermod -u 1000 www-data
WORKDIR /var/www
# Copy nginx configuration
RUN cp deploy/config/nginx.conf /etc/nginx/ && \
rm /etc/nginx/conf.d/default.conf && \
cp -r deploy/shared/sites /etc/nginx/sites-available && \
cp -r deploy/shared/ssl /etc/nginx/ssl && \
# Copy laravel configuration
cp deploy/config/laravel.ini /usr/local/etc/php/conf.d && \
cp deploy/config/xlaravel.pool.conf /usr/local/etc/php-fpm.d && \
# Copy opcache configuration
cp deploy/config/opcache.ini /usr/local/etc/php/conf.d/opcache.ini && \
# Copy php configuration
cp deploy/config/php.ini /usr/local/etc/php/php.ini && \
# Copy supervisord.d configuration
cp deploy/config/startup.sh /opt/startup.sh && \
cp deploy/config/supervisord.conf /etc/supervisord.conf && \
rm -rf docker deploy build
ARG COMPOSER_INSTALL=false
ARG COMPOSER_INSTALL_DEV=false
RUN if [ ${COMPOSER_INSTALL} = true ]; then \
if [ ${COMPOSER_INSTALL_DEV} = true ]; then \
composer install; \
else \
composer install --no-dev; \
fi \
;fi
CMD ["/bin/bash", "/opt/startup.sh"]
EXPOSE 80 443