Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing PHP extensions in Base image #53

Open
thkus opened this issue Jan 21, 2022 · 3 comments
Open

Missing PHP extensions in Base image #53

thkus opened this issue Jan 21, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@thkus
Copy link

thkus commented Jan 21, 2022

Description

While running a deployment via gitlab-ci the latest base image craftcms/nginx:8.0 was pulled from Docker Hub.
The subsequent composer install failed because several PHP extensions were suddenly missing.
Has there been a change in the base image that caused this?

How could we possibly avoid changes like that? Is there a versioning in place so we can set fixed versions for the base images we use?

Problem 1
- Root composer.json requires PHP extension ext-simplexml * but it is missing from your system. Install or enable PHP's simplexml extension.

Problem 2
- craftcms/cms is locked to version 3.7.28 and an update of this package was not requested.
- craftcms/cms 3.7.28 requires ext-dom * -> it is missing from your system. Install or enable PHP's dom extension.

Steps to reproduce

  1. Create a Dockerfile which pulls the base image craftcms/nginx:8.0
  2. Run composer install

Additional info

  • Craft version: 3.7.x
  • PHP version: 8.0
  • Database driver & version: mysql
  • Plugins & versions: n/a
@thkus thkus added the bug Something isn't working label Jan 21, 2022
@jasonmccallister
Copy link
Contributor

jasonmccallister commented Jan 21, 2022

Hi @thkus, I just ran the following to verify the extension is there and it shows up.

Can you run the following and provide the output?

docker run --rm --pull always --entrypoint php -it craftcms/nginx:8.0 -m

@jasonmccallister jasonmccallister self-assigned this Jan 21, 2022
@jasonmccallister
Copy link
Contributor

Just a few follow up items:

  1. How are you running composer? The craftcms/nginx:x images don't contain composer except the -dev images which are used for Nitro.
  2. If you are running composer in its own container, it has no extensions so you have to run composer install --ignore-platform-reqs
  3. Can you provide your Dockerfile

@thkus
Copy link
Author

thkus commented Jan 21, 2022

Hi @jasonmccallister,

thanks for the quick reply.

The output from docker run --rm --pull always --entrypoint php -it craftcms/nginx:8.0 -m is:

[PHP Modules]
bcmath
blackfire
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
imagick
intl
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
SimpleXML
soap
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
blackfire

Our Dockerfile looks like this (stripped down, but reproducible):

FROM craftcms/nginx:8.0

# Be root
USER root

# Install build dependencies
RUN apk add --no-cache --virtual .build-deps composer 

# Copy code base
COPY --chown=www-data:www-data ./site /app

# Don't run composer as root
USER www-data

# Install dependencies
RUN composer install --prefer-dist --no-scripts --no-dev --no-interaction -d /app/

# Don't be root anymore
USER www-data

# Overwrite entrypoint
ENTRYPOINT [ "sh", "/etc/startup.sh" ]

It works when i manually install dependencies like so:

RUN apk add --no-cache mysql-client \
                        libxml2-dev \
                        php8-mbstring \
                        php8-xml \
                        php8-xmlreader \
                        php8-xmlwriter \
                        php8-pdo \
                        php8-dom \
                        php8-simplexml \
                        php8-fileinfo \
                        php8-tokenizer \
                        php8-gd \
                        libpng-dev \
                        libpng \
                        $PHPIZE_DEPS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants