Docker dev-container for Drupal development based of Microsoft PHP image
10K+
Drupal development container based on Microsoft PHP devcontainer image.
Devcontainer image is to be used for development inside a container. This image is loaded with the tools required to develop a Drupal & NodeJs project.
It can be used as standalone and it is recommended to use alchatti/drupal-devcontainer with VS Code for an interactive development experience with required extentions installed.
A base Drupal project is available at alchatti/drupal-devcontainer-sample-project
Dev feature are set for the container user vscode, a none root user provided by the Microsoft base image.
Apache server will start as part of the a startup script using command
apache2ctl start
Xdebug port is
9003, the default client port.
Drupal 10 can be installed with SQLite without the need for an additional database container.
For best Dev experience, start the container as vscode user. Hostname drupal-dev can be changed to any other name.
drupal-dev-html to persist the site installation. typedocker run --rm -it \
-h "drupal-dev" \
-u "vscode" \
-p 80:80 \
-v "drupal-dev-html:/var/www/html" \
alchatti/drupal-devcontainer:8.1 fish
Once the container finishes intializing visit http://localhost to show PHP information page.
You can use init.sh command to create a new Drupal 10 site. Use SQLite as the database option for a self contained image. This script is based on Acquia configuration. You can also setup Drupal your self.
init.sh
Once the Drupal is installed visit http://localhost, to start setting up Drupal.
For demo purpose, select Demo: Umami Food Magazine (Experimental) as installation profile.
For database use the SQLite and the Database file as default sites/default/files/.ht.sqlite.
Configure the site by setting up the admin user name and password
visit http://localhost to show the Drupal site.
To exit the container and stop the service, type
exit
docker volume rm drupal-dev-html
zsh and the theme to 'blue-owl' by using environment variable POSH_THEME_ENVIRONMENT, for more theme options check Oh My Posh theme.docker run --rm -it \
-e POSH_THEME_ENVIRONMENT='blue-owl'
-h "drupal-dev" \
-u "vscode" \
-p 80:80 \
-v "drupal-dev-html:/var/www/html" \
alchatti/drupal-devcontainer:8.1 zsh
To target a specific version build the tag is configured as follow $php-$datetime
Available tags:
8.2: PHP 8.2 with latest Node.js, and Composer at build.8.1: PHP 8.1 with latest Node.js, and Composer at build.Legacy / Deprecated tags:
7.4: PHP 7.4 with latest Node.js, and Composer at build. (last build 2023DEC01)You can also use timestamped tags to target a specific build. Check https://hub.docker.com/r/alchatti/drupal-devcontainer/tags for available tags.
The image is targeting the latest 8.1 & 8.2 versions of PHP with latest Node.js.
# print image package versions/tags in json format
about | jq
# create a time stamped sql dump of the database using drush and store it under /var/www/html/dump
dump.sh
# Download latest acquia cloud database backup using acli
acli-dump.sh
The base image comes with Zsh, Apache, Xdebug, Composer.
With the following additional packages:
Drupal dev tools
Acquia tools
Front-End development
Terminal enhancements:
Git enhancements:
The following are environment variables for customization.
# ENV Defaults fpr APACHE
ENV APACHE_SERVER_NAME "localhost"
ENV APACHE_DOCUMENT_ROOT "docroot"
ENV WORKSPACE_ROOT "/var/www/html"
# ENV Default theme for Oh My Posh
ENV POSH_THEME_ENVIRONMENT "ys"
The process is automated using GitHub Actions workflow with two scripts:
build.sh: Builds the image based on PHP, Node, Sass version with the following arguments:
-p: PHP version or (7 & 8).-n: Node.js version, node for latest, --lts for lts version.test.sh: to load the latest local build image.
The workflow is set on schedule and triggered on push to the main branch. It also can be triggered manually from GitHub.
fish now uses repository for installation.2->42->32.0.0->33->5peter-evans/dockerhub-description@v3 as it is being maintained.APACHE_DOCUMENT_ROOT & WORKSPACE_ROOT in apache2.conf to enable in /etc/apache2/sites-available/*.confgit-quick-stats added to the image.fish updated to 3.6.4-1.about script to prints base image OS version.7.4 PHP version.arm64 support for both PHP 8.1 and 7.4fish with nvm.Content type
Image
Digest
sha256:c1de50113…
Size
477.4 MB
Last updated
18 days ago
docker pull alchatti/drupal-devcontainer:8.3