Skip to content

Commit 8a3cf46

Browse files
committed
Changed Dockerfile.
1 parent 1c67afe commit 8a3cf46

File tree

1 file changed

+25
-37
lines changed

1 file changed

+25
-37
lines changed

Dockerfile

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,47 @@
1-
# This file is part of Hyperf.
1+
# Default Dockerfile
22
#
3-
# @link https://hyperf.org
4-
# @document https://wiki.hyperf.org
5-
# @contact group@hyperf.org
3+
# @link https://www.hyperf.io
4+
# @document https://doc.hyperf.io
5+
# @contact group@hyperf.io
66
# @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
77

8-
FROM swoft/alphp:base
9-
LABEL maintainer="hyperf <group@hyperf.org>" version="1.0"
8+
FROM hyperf/hyperf:7.2-alpine-cli
9+
LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT"
1010

1111
##
1212
# ---------- env settings ----------
1313
##
14-
ENV SWOOLE_VERSION=4.3.5 \
15-
COMPOSER_VERSION=1.8.5 \
16-
# install and remove building packages
17-
PHPIZE_DEPS="autoconf dpkg-dev dpkg file g++ gcc libc-dev make php7-dev php7-pear pkgconf re2c pcre-dev zlib-dev libtool automake"
14+
# --build-arg timezone=Asia/Shanghai
15+
ARG timezone
16+
17+
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
18+
COMPOSER_VERSION=1.8.6 \
19+
APP_ENV=prod
1820

1921
# update
2022
RUN set -ex \
2123
&& apk update \
22-
# for swoole extension libaio linux-headers
23-
&& apk add --no-cache libstdc++ openssl php7-xml php7-xmlreader php7-xmlwriter php7-pcntl git bash \
24-
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS libaio-dev openssl-dev \
25-
26-
# download
27-
&& cd /tmp \
28-
&& curl -SL "https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz" -o swoole.tar.gz \
29-
&& ls -alh \
30-
31-
# php extension:swoole
32-
&& cd /tmp \
33-
&& mkdir -p swoole \
34-
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
35-
&& ( \
36-
cd swoole \
37-
&& phpize \
38-
&& ./configure --enable-mysqlnd --enable-openssl \
39-
&& make -s -j$(nproc) && make install \
40-
) \
41-
&& echo "extension=swoole.so" > /etc/php7/conf.d/swoole.ini \
42-
&& echo "swoole.use_shortname = 'Off'" >> /etc/php7/conf.d/swoole.ini \
43-
4424
# install composer
4525
&& cd /tmp \
46-
## && curl -sS https://getcomposer.org/installer | php \
4726
&& wget https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar \
4827
&& chmod u+x composer.phar \
4928
&& mv composer.phar /usr/local/bin/composer \
50-
&& composer self-update --clean-backups \
51-
52-
# clear
29+
# show php version and extensions
5330
&& php -v \
5431
&& php -m \
32+
# ---------- some config ----------
33+
&& cd /etc/php7 \
34+
# - config PHP
35+
&& { \
36+
echo "upload_max_filesize=100M"; \
37+
echo "post_max_size=108M"; \
38+
echo "memory_limit=1024M"; \
39+
echo "date.timezone=${TIMEZONE}"; \
40+
} | tee conf.d/99-overrides.ini \
41+
# - config timezone
42+
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
43+
&& echo "${TIMEZONE}" > /etc/timezone \
5544
# ---------- clear works ----------
56-
&& apk del .build-deps \
5745
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
5846
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
5947

0 commit comments

Comments
 (0)