How to: Own PHP image
Fabian Blechschmidt
I read yesterday a discussion on phpc.social a Mastodon instance for the PHP community about docker images and how to make them work for you. Btw, all the following hard work is done by my great colleague Thomas Spigel.
In our case, we want to use it for deployments , testing (especially cypress ) and our newest addition serverless to deploy bref .
Extend the Dockerfile
We have a small little repository with our own Dockerfile and a README.md. The Dockerfile looks like this:
FROM php:8.2-cli
MAINTAINER Developer dev@example.org
RUN apt-get update && \
apt-get install -y --no-install-recommends\
unzip \
libsodium-dev \
libssh2-1-dev \
git \
zlib1g-dev \
libpng-dev \
libcurl4-openssl-dev \
libxml2-dev \
libonig-dev \
libzip-dev \
ssh \
wget \
rsync \
gpg \
jq \
xvfb \
libgconf-2-4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libgdk-pixbuf2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnss3-dev \
libxss-dev \
libasound-dev \
libasound2-dev \
libasound2 \
dirmngr \
gpg-agent
# Install serverless
RUN curl -o- -L https://slss.io/install | VERSION=3.38.0 bash
# Install phive
RUN wget -O phive.phar https://phar.io/releases/phive.phar && \
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc && \
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79 && \
gpg --verify phive.phar.asc phive.phar && \
chmod +x phive.phar && \
mv phive.phar /usr/local/bin/phive
# cypress reqs
RUN wget https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -O /usr/local/bin/install-php-extensions && \
wget https://getcomposer.org/download/latest-stable/composer.phar -O /usr/local/bin/composer && chmod +x /usr/local/bin/composer && \
chmod +x /usr/local/bin/install-php-extensions && \
IPE_GD_WITHOUTAVIF=1 install-php-extensions gd intl pdo_mysql zip pcntl && \
git clone https://github.com/php/pecl-networking-ssh2.git /usr/src/php/ext/ssh2 && \
IPE_GD_WITHOUTAVIF=1 docker-php-ext-install -j$(nproc) gd intl pdo_mysql zip ssh2 pcntl && \
rm -rf /var/lib/apt/lists/*
README.md
And then we have a readme file which contains the command to build the images (even a linux compatible images built on mac) and upload it to docker.
docker buildx build . --platform linux/amd64 --push -t developer/name:8.2
Other articles from this category
Zahlarten in Shopware 6 nur für Stammkunden anzeigen
Manche Zahlarten möchte man nicht jedem Kunden sofort anbieten. Rechnungskauf ist so ein Klassiker. Bei bekannten Kunden ist das Risiko überschaubarer, bei Neukunden möchte man vielleicht erstmal Vorkasse, PayPal, Kreditkarte oder eine andere abgesicherte Zahlart nutzen. In Shopware 6 lässt sich das ohne Plugin lösen. Der Rule Builder reicht dafür völlig aus. Regel für Stammkunden […]
Deliverability („Zustellbarkeit“) – warum „Senden“ nicht gleich „Ankommen“ ist
Deliverability („Zustellbarkeit“) ist der Vorgang, mit dem E-Mails in den Posteingängen der Abonnenten landen – und es ist eine Kunst… und eine Wissenschaft. Denn viele Aspekte liegen in unserer Hand (Infrastruktur, E-Mail-Vorlagen…) und auf andere wiederum haben wir keinen direkten Einfluss, etwa die Regeln, welche die E-Mail-Provider zur Entscheidungsfindung („Das ist Spam!“) benutzen. Das heißt […]
SCUC 2026: Impressions
I attended the fifth SCUC – my third visit overall. Unlike a regular conference with hundreds or even thousands rushing through crowded halls to attend one-sided presentations, SCUC’s format in which themes are proposed and presented by the participants results in compelling panels, presentations, and open discussions. The mixture of Developers, PMs, ecommerce agencies and […]