-
-
Notifications
You must be signed in to change notification settings - Fork 202
/
Dockerfile-debian
executable file
·144 lines (111 loc) · 3.72 KB
/
Dockerfile-debian
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
# PHP Docker image for Yii 2.0 Framework runtime
# ==============================================
ARG PHP_BASE_IMAGE_VERSION
FROM php:${PHP_BASE_IMAGE_VERSION} AS min
# Install required system packages for PHP extensions for Yii 2.0 Framework
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions \
intl
# Environment settings
ENV PHP_USER_ID=33 \
PATH=/app:/app/vendor/bin:/root/.composer/vendor/bin:$PATH \
TERM=linux
# Add configuration files
COPY image-files/min/ /
# Enable mod_rewrite for images with apache
RUN if command -v a2enmod >/dev/null 2>&1; then \
a2enmod rewrite headers \
;fi
# Install Yii framework bash autocompletion
RUN mkdir /etc/bash_completion.d && \
curl -L https://raw.githubusercontent.com/yiisoft/yii2/master/contrib/completion/bash/yii \
-o /etc/bash_completion.d/yii
# Application environment
WORKDIR /app
RUN chmod 755 \
/usr/local/bin/docker-php-entrypoint
FROM min AS dev
ARG PECL_IMAGICK_INSTALL_SUFFIX
ARG PECL_MONGODB_INSTALL_SUFFIX
ARG PECL_XDEBUG_INSTALL_SUFFIX
# Install system packages
RUN apt-get update && \
apt-get -y install \
git \
unzip \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install common system packages for PHP extensions recommended for Yii 2.0 Framework
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions \
imagick${PECL_IMAGICK_INSTALL_SUFFIX} \
mongodb${PECL_MONGODB_INSTALL_SUFFIX} \
xdebug${PECL_XDEBUG_INSTALL_SUFFIX} \
pdo_mysql \
pdo_pgsql \
gd \
pcntl \
soap \
zip \
bcmath \
exif \
opcache
# Add configuration files
COPY image-files/dev/ /
# Disable xdebug by default (see PHP_ENABLE_XDEBUG)
RUN rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# Add GITHUB_API_TOKEN support for composer
RUN chmod 755 \
/usr/local/bin/docker-php-entrypoint \
/usr/local/bin/composer
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--filename=composer.phar \
--install-dir=/usr/local/bin && \
composer clear-cache
# Environment settings
ENV COMPOSER_ALLOW_SUPERUSER=1 \
PHP_ENABLE_XDEBUG=0
FROM min AS nginx-min
# Install nginx
RUN apt-get update \
&& apt-get install -y --force-yes \
nginx-full \
cron \
supervisor \
procps \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV SUPERVISOR_START_FPM=true \
SUPERVISOR_START_NGINX=true
# Add configuration files
COPY image-files/nginx/ /
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& ln -sf /usr/sbin/cron /usr/sbin/crond
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
EXPOSE 80 443
FROM dev AS nginx-dev
# Install nginx
RUN apt-get update \
&& apt-get install -y --force-yes \
nginx-full \
cron \
supervisor \
procps \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV SUPERVISOR_START_FPM=true \
SUPERVISOR_START_NGINX=true
# Add configuration files
COPY image-files/nginx/ /
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& ln -sf /usr/sbin/cron /usr/sbin/crond
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
EXPOSE 80 443