-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.cn
51 lines (37 loc) · 1.83 KB
/
Dockerfile.cn
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
FROM php:latest-alpine3.14
MAINTAINER jani <[email protected]>
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk update && apk upgrade \
&& apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community/ gnu-libiconv=1.15-r3
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
WORKDIR /app/
# apk 添加扩展依赖
# 配置 GD
# 使用 docker-php-ext-install 安装可直接安装的依赖
RUN apk add libzip-dev zlib-dev libbz2 \
freetype-dev libpng-dev libjpeg-turbo-dev libxpm-dev \
curl-dev openssl-dev nghttp2-dev pcre-dev c-ares-dev \
&& docker-php-ext-configure gd --enable-gd --with-jpeg --with-xpm --with-freetype \
&& docker-php-ext-install bcmath iconv pcntl gd zip mysqli pdo_mysql \
sysvmsg sysvsem sysvshm sockets
# 添加安装包到指定目录,只支持 tar 类型的安装包,所以需要去 pecl.php.net 网站下载
# 安装编译工具
# 编译安装
# 清空安装包,无用的关联工具
COPY ./pecl/ /app/pecl/
RUN apk add gcc g++ autoconf make \
&& printf "\n" | pecl install /app/pecl/redis-5.3.5RC1.tgz \
&& printf "\n" | pecl install /app/pecl/swoole-4.8.2.tgz \
&& docker-php-ext-enable swoole redis \
&& rm -rf /app/pecl/ \
&& apk del autoconf make
# 添加 composer 并使用阿里源
COPY --from=composer:2.1.12 /usr/bin/composer /usr/local/bin/composer
RUN chmod +x /usr/local/bin/composer \
&& /usr/local/bin/composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \
&& composer self-update --clean-backups
# 修改容器时区
RUN apk add --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& echo -e "[Date]\ndate.timezone=Asia/Shanghai" > /usr/local/etc/php/conf.d/timezone.ini