Files
crmchat/docker/php/Dockerfile
T

44 lines
1.5 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; \
# bullseye 已 EOL(2026-08),security 包在镜像站/archive 间迁移暂不可用:构建期去掉 security 源,
# 仅用 main/updates(阿里云池完好)。中期应将基础镜像升级到受支持的 Debian/PHP 版本
sed -i '/debian-security/d; 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"]