Files
crmchat/docker/php/Dockerfile
T

43 lines
1.4 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
ARG PHP_BASE_IMAGE=php:7.4-cli
ARG COMPOSER_IMAGE=composer:latest
FROM ${COMPOSER_IMAGE} AS composer
FROM ${PHP_BASE_IMAGE}
RUN set -eux; \
# 国内 ECS 访问 deb.debian.org(Fastly)易超时:main/updates 走阿里云镜像,security 走 TUNA(同步更及时)
sed -i 's|deb.debian.org/debian-security|mirrors.tuna.tsinghua.edu.cn/debian-security|g; s|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list; \
apt-get update && apt-get install -y --no-install-recommends \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libzip-dev \
libssl-dev \
unzip \
git \
default-mysql-client \
; \
docker-php-ext-configure gd --with-freetype --with-jpeg; \
docker-php-ext-install -j$(nproc) gd pdo_mysql bcmath zip pcntl; \
pecl install redis-5.3.7; \
docker-php-ext-enable redis; \
pecl install swoole-4.8.11; \
docker-php-ext-enable swoole; \
rm -rf /var/lib/apt/lists/* /tmp/pear
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Composer 阿里云镜像(备用,vendor 已提交通常不需要)
RUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
WORKDIR /var/www/html
COPY swoole.php /tmp/swoole_docker.php
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN sed -i 's/\r$//' /usr/local/bin/entrypoint.sh && chmod +x /usr/local/bin/entrypoint.sh
EXPOSE 20108
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]