Skip to content

Commit

Permalink
Remove images with "drud" in them (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay authored Dec 31, 2024
1 parent c2230f8 commit acce6ad
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Binary file added public/img/blog/2020/04/Dockerfile.cron.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/img/blog/2020/04/d8composer.png
Binary file not shown.
Binary file modified public/img/edit-docs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/pr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
---
title: "Customizing DDEV images with a custom Dockerfile"
pubDate: 2020-04-07
modifiedDate: 2023-02-21
modifiedComment: Prepended `.ddev/web-build/` to the `mailhog.conf` example, as the `ADD` directive must be project-root relative.
summary: How you can use a custom Dockerfile to tailor DDEV’s images, complete with examples.
modifiedDate: 2024-12-31
modifiedComment: Updated obsolete content.
summary: How to use a custom Dockerfile to tailor DDEV’s images, complete with examples.
author: Randy Fay
featureImage:
src: /img/blog/2020/04/d8composer.png
src: /img/blog/2020/04/Dockerfile.cron.png
alt: Tightly-cropped screenshot of a Dockerfile in an IDE.
shadow: true
categories:
- Guides
---

Did you know that you can customize [DDEV](https://github.com/ddev/ddev) Docker images with some very simple changes?
Did you know that you can customize [DDEV](https://github.com/ddev/ddev) Docker images with some very simple changes? See the [full docs](https://ddev.readthedocs.io/en/stable/users/extend/customizing-images/) but we'll give some examples here.

There are two major ways to customize your DDEV web image:

1. Add a Debian package into the image with `webimage_extra_packages` ([docs](https://ddev.readthedocs.io/en/stable/users/extend/customizing-images/#adding-extra-debian-packages-with-webimage%5Fextra%5Fpackages-and-dbimage%5Fextra%5Fpackages)).
1. Add a Debian package into the image with `webimage_extra_packages` ([docs](https://ddev.readthedocs.io/en/stable/users/extend/customizing-images/#adding-extra-debian-packages-with-webimage_extra_packages-and-dbimage_extra_packages)).
2. Add an “extension” Dockerfile with free-form instructions for adding onto the container ([docs](https://ddev.readthedocs.io/en/stable/users/extend/customizing-images/#adding-extra-dockerfiles-for-webimage-and-dbimage)).

You can use these together (add packages with `webimage_extra_packages` and also do more sophisticated things in a Dockerfile).

### `webimage_extra_packages` in `config.yaml`

The simplest thing to do is add new Debian packages. For example, add to the `.ddev/config.yaml`: `webimage_extra_packages: [redis-tools, php8.1-yaml]`, and the redis-tools and “php8.1-yaml packages will be installed in the web container. This little addition to the container happens once, and doesn’t slow down your `ddev start` after that.
The simplest thing to do is add new Debian packages. For example, add to the `.ddev/config.yaml`: `webimage_extra_packages: [redis-tools, php${DDEV_PHP_VERSION}-yaml]`, and the `redis-tools` and `php${DDEV_PHP_VERSION}-yaml` (with your PHP version) packages will be installed in the web container. This little addition to the container happens once, and doesn’t slow down your `ddev start` after that.

### Simple npm install with custom Dockerfile

Sometimes, though, people need to do things that are more specific than changing Debian apt packages. For example, you might want to override a configuration file with a replacement, or you might want to use npm to install something that is not managed with Debian’s package system.

This kind of change can be done by creating a `.ddev/web-build/Dockerfile` (start by copying `.ddev/web-build/Dockerfile.example`).
This kind of change can be done by creating a `.ddev/web-build/Dockerfile.*` (we'll use `Dockerfile.gulp-cli). Start by copying `.ddev/web-build/Dockerfile.example`.

So, for example, if you have a `.ddev/web-build/Dockerfile` with these contents:
So, for example, if you have a `.ddev/web-build/Dockerfile.gulp-cli` with these contents:

```docker
RUN npm install --global gulp-cli
Expand All @@ -51,13 +51,13 @@ If you want to add files or override configuration files, it’s easy enough to
ADD .ddev/web-build/mailhog.conf /etc/supervisor/conf.d
```

But you could use this same technique for so many things. Do you need to completely override the /etc/php/8.1/fpm/php-fpm.conf file? Do it. Do you need to completely revamp the entire nginx configuration directory? Now you can do it. You can also add scripts into the container or even Linux binaries. And you can check the whole thing into your project so that other members of your team automatically have it.
But you could use this same technique for so many things. Do you need to completely override the /etc/php/8.4/fpm/php-fpm.conf file? Do it. Do you need to completely revamp the entire nginx configuration directory? You can do it. You can also add scripts into the container or even Linux binaries. And you can check the whole thing into your project so that other members of your team automatically have it.

### pip3 installs

The Python world uses [pip3](https://pip.pypa.io/en/stable/) to install packages, and you can do that too.

This [Stack Overflow answer](https://stackoverflow.com/a/60683558/215713) goes into the details, but this Dockerfile should be a start:
This [Stack Overflow answer](https://stackoverflow.com/a/60683558/215713) goes into the details, but this Dockerfile.mycli should be a start:

```docker
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confnew" --no-install-recommends --no-install-suggests python3-pip python3-setuptools
Expand All @@ -80,4 +80,4 @@ RUN cp /etc/php/7.1/mods-available/mcrypt.ini /etc/php/${DDEV_PHP_VERSION}/mods-

## Join the conversation!

We’d love to hear about your recipes! Discuss them in our [Discord channel](/s/discord), create a new [DDEV Add-on](https://ddev.readthedocs.io/en/stable/users/extend/additional-services/), or tweet, or blog about them and give us a holler when you do. And we’re always happy to hear from you on any of our [support channels](https://ddev.readthedocs.io/en/stable/users/support/).
We’d love to hear about your recipes! Discuss them in our [Discord channel](/s/discord), create a new [DDEV Add-on](https://ddev.readthedocs.io/en/stable/users/extend/additional-services/), and let us know when you do, or blog about them and give us a holler when you do. And we’re always happy to hear from you on any of our [support channels](https://ddev.readthedocs.io/en/stable/users/support/).
2 changes: 1 addition & 1 deletion src/pages/support-ddev.astro
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const title = `Support DDEV`

<Image
src="/img/pr.png"
alt="Screenshot of GitHub PR #217, where @beeradb added new version notifications"
alt="Screenshot of GitHub PR #6848, where @gitressa added database management examples"
class="rounded-lg"
width={600}
height={400}
Expand Down

0 comments on commit acce6ad

Please sign in to comment.