This guest post is by DDEV community member and Drupal contributor Bill Seremetis and sponsored by Annertech.
DDEV comes bundled with a predefined set of tools, Pantheon's terminus
being one of them.
The latest releases of terminus
are not compatible with older PHP versions like PHP 8.1, though,
so we needed to downgrade it inside DDEV's ddev-webserver
Docker image.
This guide covers how to downgrade terminus
and will also explain how to use the same technique to install
additional custom tools.
Please note there are many ways to install packages in a container. We will
cover extra Dockerfiles
here, but also check webimage_extra_packages
and dbimage_extra_packages
in your
config.yaml
for more details).
Case study: Manually Downgrading Terminus
Terminus dropped
support for PHP 8.1 in recent versions, but some of our
projects still use PHP 8.1. We had to downgrade the DDEV-bundled version of terminus
for those
projects by using a custom Dockerfile:
# .ddev/web-build/Dockerfile.terminus
# Terminus 4 drops support for PHP 8.1 which we still need
ARG TERMINUS_VERSION="3.6.2"
RUN curl -L --fail -o /usr/local/bin/terminus https://github.com/pantheon-systems/terminus/releases/download/${TERMINUS_VERSION}/terminus.phar && chmod +x /usr/local/bin/terminus
terminus
is just an example here, it could be any command you wish,
either because you are running an older PHP version
or the bundled version has a bug that ruins things for you.
Installing custom tools
You can obviously use the same techniques to install a variety of custom tools:
# .ddev/web-build/Dockerfile.fzf
# fooscript relies on fzf
# fooscript lists all your Pantheon projects using a fuzzy finder list
ARG FZF_VERSION="0.62.0"
RUN curl -s -L https://github.com/junegunn/fzf/releases/download/v${FZF_VERSION}/fzf-${FZF_VERSION}-linux_amd64.tar.gz | tar xvz -C /usr/local/bin/ && chmod +x /usr/local/bin/fzf
Resources
- DDEV Pantheon integration documentation
- Adding extra Dockerfiles for
webimage
anddbimage
- Adding extra Debian packages in DDEV
- Customizing DDEV images with a custom Dockerfile
Contribute to DDEV
If you like DDEV then you are welcome to contribute! You can join the Discord channel, create a new DDEV Add-on, or blog about how you use DDEV in your daily workflow. We’re always happy to hear from you on any of our support channels.