-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathDockerfile-debian
executable file
·147 lines (112 loc) · 3.64 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
145
146
147
# PHP Docker image for Yii 3.x Framework runtime
# ==============================================
ARG PHP_BASE_IMAGE_VERSION
FROM php:${PHP_BASE_IMAGE_VERSION} AS min
# Install required system packages for PHP extensions for Yii 3.x 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/ /
RUN chmod 700 \
/usr/local/bin/docker-php-entrypoint
# Enable mod_rewrite for images with apache
RUN if command -v a2enmod >/dev/null 2>&1; then \
a2enmod rewrite headers \
;fi
# Application environment
WORKDIR /app
FROM min AS dev
ARG PECL_IMAGICK_INSTALL_SUFFIX
# Install system packages
RUN apt-get update && \
apt-get -y install \
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
RUN install-php-extensions \
imagick${PECL_IMAGICK_INSTALL_SUFFIX} \
mongodb \
xdebug \
pcntl \
soap \
zip \
bcmath \
exif \
gd \
opcache \
pdo_mysql \
pdo_pgsql \
sockets
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
RUN if [ `echo "$VERSION_XDEBUG" | grep -cE [3][.][0-9]+[.][0-9]+.*` = 1 ]; then \
rm /usr/local/etc/php/conf.d/xdebug2.ini; \
else \
rm /usr/local/etc/php/conf.d/xdebug3.ini; \
fi
# Add GITHUB_API_TOKEN support for composer
RUN chmod 700 \
/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
# Install node (for asset management with foxy)
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs && \
npm install -g yarn
# 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