nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.27k stars 324 forks source link

how to add in image #1030

Closed IvayLoRD closed 5 months ago

IvayLoRD commented 6 months ago

Hello, sorry for the question, it may seem stupid to you, can someone explain how it could be added BC Math Fileinfo, GMP, Iconv, Intl, MBString, OpenSSL***, SOAP and ionCube Loader for PHP version in image public.ecr.aws/nginx/unit:1.31.1-php8.2 because I didn't see anything like that anywhere .

thresheek commented 6 months ago

Hi @IvayLoRD!

Since this image is based on Docker Official PHP image, you can use the documentation from https://hub.docker.com/_/php section "How to install more PHP extensions".

Let us know if that works for you!

JanMikes commented 6 months ago

Hi, you can use either pecl or i recommend installing and using https://github.com/mlocati/docker-php-extension-installer

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/

RUN install-php-extensions bcmath \
    iconv  ## and more ..
javorszky commented 6 months ago

Hi @IvayLoRD,

I had to install some of these packages on top of a unit image yesterday. Here's my docker file that I used as a base for working with WordPress:

FROM unit:1.31.1-php8.2

# Install absolutely required packages without which WordPress does not start
RUN apt update && apt install -y libicu-dev git
RUN docker-php-ext-install intl pdo_mysql mysqli 

# Install exif, opcache, shmop, sockets, and zip packages
RUN apt install -y libzip-dev ghostscript
RUN docker-php-ext-install exif opcache shmop sockets zip

# Install ssh2 php module
RUN apt install -y libssh2-1-dev libssh2-1
RUN pecl install ssh2
RUN docker-php-ext-enable ssh2

# Install imagick extension
RUN apt install -y libmagickwand-dev
RUN pecl install imagick
RUN docker-php-ext-enable imagick

# Install igbinary
RUN pecl install igbinary
RUN docker-php-ext-enable igbinary

# Install redis
RUN pecl install redis
RUN docker-php-ext-enable redis

# Install image (the php extension "image" per the handbook)
RUN docker-php-ext-install gd

# Install bc (bcmath)
RUN docker-php-ext-install bcmath

WORKDIR /wpms/

RUN chown -R unit:unit /wpms/

Your actual needs will be different, but in general the two potential ways of installing packages are

For more info see https://hub.docker.com/_/php, the "How to install more PHP extensions heading"

Alternatively the way @JanMikes showed would also work.