-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
102 lines (87 loc) · 2.71 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
FROM php:8.1-fpm-alpine
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \
PHP_OPCACHE_MEMORY_CONSUMPTION="192" \
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" \
PHP_MEMORY_LIMIT="512M" \
PHP_MAX_EXECUTION_TIME="60" \
PHP_FPM_MAX_CHILDREN="100" \
PHP_FPM_MAX_REQUESTS="1000" \
PHP_FPM_PM="ondemand" \
PHP_FPM_PROCESS_IDLE_TIMEOUT="10s"
# create working dir
RUN mkdir /opt/app
WORKDIR /opt/app
# install wait-for-it
ADD https://github.com/vishnubob/wait-for-it/raw/master/wait-for-it.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/wait-for-it.sh
# copy runit services
COPY ./etc/service/ /etc/service/
RUN find /etc/service/ -name "run" -exec chmod -v +x {} \;
# copy nginx config files
COPY ./etc/nginx/conf.d/ /etc/nginx/conf.d/
COPY ./etc/nginx/nginx.conf /etc/nginx/nginx.conf
# copy php config files
COPY ./usr/local/etc/php/ /usr/local/etc/php/
COPY ./usr/local/etc/php-fpm.d/ /usr/local/etc/php-fpm.d/
# copy bin files
COPY ./usr/local/bin/startup-commands.php /usr/local/bin/
# copy root folder and make run scripts executable
COPY ./root/ /root/
RUN find /root -name "*.sh" -exec chmod -v +x {} \;
RUN apk info \
&& echo @iconv-fix http://dl-cdn.alpinelinux.org/alpine/v3.13/community >> /etc/apk/repositories \
&& apk update \
&& apk upgrade \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
&& apk add --no-cache \
zlib-dev \
icu-dev \
libzip-dev \
libjpeg-turbo-dev \
libpng-dev \
libxml2-dev \
freetype-dev \
gnu-libiconv@iconv-fix=1.15-r3 \
sudo \
bash \
runit \
nginx \
git \
nodejs \
npm \
yarn \
mysql-client \
mariadb-connector-c \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
gd \
pdo_mysql \
zip \
bcmath \
exif \
intl \
opcache \
pcntl \
&& pecl install \
redis \
&& docker-php-ext-enable redis \
&& apk del .build-deps \
&& rm -rf /tmp/* /var/cache/apk/*
COPY --from=composer /usr/bin/composer /usr/bin/composer
# configure composer
ENV COMPOSER_ALLOW_SUPERUSER=1 \
COMPOSER_MEMORY_LIMIT=-1 \
PATH="$PATH:/opt/app/vendor/bin:~/.composer/vendor/bin"
# fix iconv (see https://github.com/docker-library/php/issues/240#issuecomment-876464325)
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so
# configure yarn
RUN yarn config set strict-ssl false && \
yarn global add cross-env
# change default shell
SHELL ["/bin/bash", "-c"]
# run the application
ENTRYPOINT ["/root/entrypoint.sh"]
CMD ["runsvdir", "/etc/service"]
EXPOSE 8080