首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Docker & PHP 8 FPM & Laravel设置

Docker & PHP 8 FPM & Laravel设置
EN

Stack Overflow用户
提问于 2022-07-01 08:28:07
回答 2查看 3K关注 0票数 0

我的应用程序有这个Dockerfile

代码语言:javascript
运行
复制
FROM php:8.0.5-fpm-alpine

WORKDIR /var/www

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

RUN apk update && apk add \
    build-base \
    freetype-dev \
    libjpeg-turbo-dev \
    libpng-dev \
    libzip-dev \
    zip \
    jpegoptim optipng pngquant gifsicle \
    vim \
    unzip \
    git \
    curl

RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd

# Install Redis Extension
RUN apk add autoconf && pecl install -o -f redis \
    &&  rm -rf /tmp/pear \
    &&  docker-php-ext-enable redis && apk del autoconf

# Copy config
COPY ./config/php/local.ini /usr/local/etc/php/conf.d/local.ini

RUN addgroup -g 1000 -S www && \
    adduser -u 1000 -S www -G www

USER www

COPY --chown=www:www . /var/www

RUN ["chmod", "+x", "./start_script.sh"]

EXPOSE 9000

CMD ./start_script.sh

当我运行docker-compose up时,它向我显示了这个错误:

代码语言:javascript
运行
复制
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20200930
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable multibyte string support... yes, shared
checking whether to enable multibyte regex support (requires oniguruma)... yes
checking for oniguruma... no
configure: error: Package requirements (oniguruma) were not met:

Package 'oniguruma', required by 'virtual:world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ONIG_CFLAGS
and ONIG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: Service 'app' failed to build: The command '/bin/sh -c docker-php-ext-install pdo_mysql mbstring zip exif pcntl' returned a non-zero code: 1

我试图研究如何解决这个问题,我认为这与mbstringmbstring扩展有关,而这个mbstring扩展在Laravel中是必需的。因此,在进一步的研究中,我试图添加apk add libonig-dev,但随后它向我展示了这个新错误:

代码语言:javascript
运行
复制
 ---> Running in 5cb4450da35b
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
v3.13.10-66-geb1876c618 [https://dl-cdn.alpinelinux.org/alpine/v3.13/main]
v3.13.10-63-g29cc5622fc [https://dl-cdn.alpinelinux.org/alpine/v3.13/community]
OK: 13914 distinct packages available
ERROR: unable to select packages:
  libonig-dev (no such package):
    required by: world[libonig-dev]
ERROR: Service 'app' failed to build: The command '/bin/sh -c apk update && apk add     build-base     libonig-dev     freetype-dev     libjpeg-turbo-dev     libpng-dev     libzip-dev     zip     jpegoptim optipng pngquant gifsicle     vim     unzip     git     curl' returned a non-zero code: 1

我真的被困在这里了,我对码头不太熟悉。

EN

Stack Overflow用户

发布于 2022-07-01 10:06:06

您可以在下面的文件中定义您的CMD,希望您能解决您的问题…!

CMD "./start_script.sh"

CMD ["bash", "start_script.sh"]

票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72826455

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档