-
Notifications
You must be signed in to change notification settings - Fork 160
/
Dockerfile
72 lines (61 loc) · 2.29 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
FROM hyperf/hyperf:8.1-alpine-v3.18-swoole
LABEL maintainer="MineManage Developers <[email protected]>" version="1.0" license="MIT" app.name="MineManage"
##
# ---------- env settings ----------
##
# --build-arg timezone=Asia/Shanghai
ARG timezone
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
APP_ENV=prod \
SCAN_CACHEABLE=(true)
# update
RUN set -ex \
# show php version and extensions
&& php -v \
&& php -m \
&& php --ri swoole \
# ---------- some config ----------
&& cd /etc/php* \
# - config PHP
&& { \
echo "upload_max_filesize=128M"; \
echo "post_max_size=128M"; \
echo "memory_limit=1G"; \
echo "date.timezone=${TIMEZONE}"; \
} | tee conf.d/99_overrides.ini \
# - config timezone
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone \
# ---------- clear works ----------
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
# update
RUN set -ex \
# ---------- some config ----------
&& cd /etc/php81 \
# - config timezone
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone \
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
RUN set -ex && \
apk update \
&& apk add --no-cache libstdc++ openssl git bash autoconf pcre2-dev zlib-dev re2c gcc g++ make \
php81-pear php81-dev php81-tokenizer php81-fileinfo php81-simplexml php81-xmlwriter \
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS zlib-dev libaio-dev openssl-dev curl-dev c-ares-dev \
&& pecl channel-update pecl.php.net \
&& pecl install --configureoptions 'enable-reader="yes"' xlswriter \
&& echo "extension=xlswriter.so" >> /etc/php81/conf.d/60-xlswriter.ini \
&& php -m \
&& php -v \
&& php --ri swoole \
&& mkdir -p /app-src \
# ---------- clear works ----------
&& apk del .build-deps \
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/local/bin/php* \
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so
WORKDIR /opt/www
COPY . /opt/www
RUN composer install --no-dev -o && php bin/hyperf.php
EXPOSE 9501 9502 9503
ENTRYPOINT ["php", "/opt/www/bin/hyperf.php", "start"]