Creating a Dockerfile that includes php, node.js, and php’s mysqli

I am trying to create a Dockerfile that defines an environment with php, node.js with express and socket.io, and mysql interoperability.

Currently I have this:

FROM php:7.2-cli

RUN apt-get update && apt-get install -y nodejs npm
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm install
RUN npm install express
RUN npm install socket.io
EXPOSE 8080
CMD [ "node", "src/Server.js" ]

The problem is, when calling a php function that uses mysqli, I get this error:

Fatal error: Uncaught Error: Class 'mysqli' not found in /usr/src/app/src/php/db_connect.php:21
Stack trace:
#0 /usr/src/app/src/php/websocketsAPI.php(11): include()
#1 {main}
  thrown in /usr/src/app/src/php/db_connect.php on line 21

I read this is due to a MySQL setting. MySQL isn’t installed on this container, so I thought that may be why. If I remember correctly, installing MySQL is not an process that can occur unattended, so I was reluctant to install MySQL using the normal apt-get system. I also read that mysqli is a php component. I don’t need MySQL on this container, except perhaps to solve this current error. What is the best way to solve this?

Source: StackOverflow