构建自己的docker镜像

发布时间: 2024-02-03

创建目录

mkdir -p /home/kejilion/php && cd /home/kejilion/php

创建Dockerfile

nano Dockerfile

 

配置

FROM php:fpm

RUN apt update && apt install -y curl

RUN mkdir -p /usr/local/bin/

RUN curl -sL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o /usr/local/bin/install-php-extensions

RUN chmod +x /usr/local/bin/install-php-extensions

RUN install-php-extensions mysqli gd intl zip opcache exif imagick redis pdo_mysql bcmath

RUN echo "upload_max_filesize=50M\npost_max_size=50M" > /usr/local/etc/php/conf.d/uploads.ini

RUN echo "memory_limit=256M" > /usr/local/etc/php/conf.d/memory.ini

RUN echo "max_execution_time=1200" > /usr/local/etc/php/conf.d/max_execution_time.ini

RUN echo "max_input_time=600" > /usr/local/etc/php/conf.d/max_input_time.ini

CMD ["php-fpm"]

 

构建镜像

docker login

docker buildx create --use

docker buildx build --platform linux/amd64,linux/arm/v5 -t kjlion/php:8.3 .

docker push kjlion/php:8.3

请在下方留下您的评论.加入TG吹水群