Based on https://github.com/microsoft/vscode-dev-containers/tree/main/containers/php
My use case is Laravel projects using php artisan serve and PHP built-in webserver rather than more complicated Apache / supervisord containers.
Designed to be a drop-in replacement for Microsoft devcontainer base images - and seperate containers for databases (etc).
Image docker.io/rjocoleman/php-cli-devcontainer hosted on DockerHub. Should be available in linux/amd64 and linux/arm64 variants.
vscode user etc.9003 for Xdebug, and sets xdebug.start_with_request to default.client_host to host.docker.internal (override with XDEBUG_CONFIG env).CMD is set to sleep infinity to prevent the container from prematurely terminating (needed by vscode).devcontainer.json as "image": "docker.io/rjocoleman/php-cli-devcontainer"docker-compose.yml as image: docker.io/rjocoleman/php-cli-devcontainerOr, if you need to customise it use it as a base in a Dockerfile:
FROM docker.io/rjocoleman/php-cli-devcontainer
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
# [Optional] Uncomment this section to install additional packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
# [Optional] Enable xdebug start_with_request
# RUN sed -i "s|xdebug.start_with_request = no|xdebug.start_with_request = yes|g" /usr/local/etc/php/conf.d/xdebug.ini
# [Optional] Add PHP extensions
# RUN docker-php-ext-install <your-extension-list-here> && docker-php-ext-enable <your-extension-list-here>
Given JavaScript front-end web client code written for use in conjunction with a PHP back-end often requires the use of Node.js-based utilities to build, this container also includes nvm so that you can easily install Node.js. You can change the version of Node.js installed or disable its installation by updating the args property in .devcontainer/devcontainer.json.
You must use the custom Dockerfile approach above to build this, Node 14 is included by default.
"args": {
"NODE_VERSION": "14" // Set to "none" to skip Node.js installation
}
This is mostly just Microsoft's excellent devcontainer image with a couple of things removed and a couple of things added.
This is built and published so that I can use it across multiple projects without needing to build each time. I make no commitments that I'll add features, maintain compatibility, incorperate any future changes from the base Microsoft devcontainers, publish new updates or in any way maintain this - but I might (no promises).
Content type
Image
Digest
Size
287.2 MB
Last updated
over 4 years ago
docker pull rjocoleman/php-cli-devcontainer