提交 b06ab6df authored 作者: 陈欢's avatar 陈欢

更新 Dockerfile

上级 cf397bab
ARG PHP_VERSION=8.1
FROM php:${PHP_VERSION}-fpm-alpine
FROM php:7.4.30-fpm-bullseye
# PHP_CPPFLAGS are used by the docker-php-ext-* scripts
ARG PHP_CPPFLAGS="$PHP_CPPFLAGS"
WORKDIR /var/www
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
# Install Nginx & PHP packages and extensions
RUN apk add --no-cache --update \
# Install packages required by PHP/Laravel
git~=2 \
icu-dev~=69 \
nginx~=1 \
unzip~=6 \
# Install mail server
msmtp~=1 \
# Install gd for image functions
freetype-dev~=2 \
libwebp-dev~=1 \
libjpeg-turbo-dev~=2 \
libpng-dev~=1 \
# Install zip for csv functions
libzip-dev~=1 \
zip~=3 \
# Configure image library
&& docker-php-ext-configure gd \
--with-jpeg \
--with-webp \
--with-freetype \
# Configure PHP extensions for use in Docker
&& docker-php-ext-install \
pdo_mysql \
opcache \
zip \
gd \
# Setup Nginx directories, permissions, and one-off configurations
&& mkdir -p /var/run/nginx \
&& chown -R www-data:www-data /var/run/nginx /var/lib/nginx /var/log/nginx \
&& sed -i 's|user nginx;|#user www-data;|' /etc/nginx/nginx.conf \
&& sed -i 's|user =|;user =|' /usr/local/etc/php-fpm.d/www.conf \
&& sed -i 's|group =|;group =|' /usr/local/etc/php-fpm.d/www.conf \
# Install the latest version of Composer
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
# Cleanup
&& rm -rf /var/cache/apk/* /tmp/*
COPY /config/nginx.conf /etc/nginx/http.d/default.conf
COPY /config/opcache.ini /usr/local/etc/php/conf.d/php-opocache-cfg.ini
COPY /config/msmtprc /etc/msmtprc
COPY /scripts/start.sh /etc/start.sh
COPY --chown=www-data:www-data src/ /var/www/html/public
RUN mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
WORKDIR /var/www/html
EXPOSE 80 443
USER www-data:www-data
RUN install-php-extensions \
bcmath \
exif \
gd \
gmp \
opcache \
pdo_mysql \
zip \
&& rm /usr/local/bin/install-php-extensions
ENTRYPOINT ["/etc/start.sh"]
RUN apk add nginx git
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论