Sign inSign up

tavib47/drupal-php

By tavib47

•Updated 8 months ago

Base PHP-FPM image for Drupal with drupal user configured

Image
Content management system
0

1.0K

tavib47/drupal-php repository overview

⁠Drupal PHP-FPM Image

Docker Hub Image Size

A base PHP-FPM image for Drupal production environments, extending php-fpm⁠ with a pre-configured drupal user. Designed as a reusable base for your Drupal project Dockerfiles.

⁠Features

Everything from php-fpm⁠, plus:

  • Pre-configured drupal user and group with configurable UID/GID
  • PHP-FPM runs as drupal user (not www-data)
  • Ready to extend with your application code

⁠Supported Tags

  • 8.5, latest
  • 8.4
  • 8.3
  • 8.2
  • 8.1

⁠Quick Start

docker pull tavib47/drupal-php:8.4

⁠Usage in Project Dockerfile

This image is designed to be extended in your project:

FROM tavib47/drupal-php:8.4

# Copy application code
COPY --chown=drupal:drupal . .

# Create Drupal directories
RUN mkdir -p /var/www/html/web/sites/default/files \
             /var/www/html/private \
             /var/www/html/tmp \
    && chown -R drupal:drupal /var/www/html/web/sites/default/files \
                              /var/www/html/private \
                              /var/www/html/tmp

EXPOSE 9000

Configure paths in settings.php:

$settings['file_private_path'] = '/var/www/html/private';
$settings['file_temp_path'] = '/var/www/html/tmp';

⁠Build Arguments

ARGDefaultDescription
PHP_VERSION8.4PHP version to use
DRUPAL_UID41821UID for the drupal user
DRUPAL_GID41821GID for the drupal group
⁠Custom UID/GID

Match the host user for local development:

docker build \
  --build-arg DRUPAL_UID=$(id -u) \
  --build-arg DRUPAL_GID=$(id -g) \
  -t my-drupal-php .

⁠Docker Compose Example

services:
  php:
    build:
      context: .
      dockerfile: docker/php/Dockerfile
      args:
        - DRUPAL_UID=${DRUPAL_UID:-41821}
        - DRUPAL_GID=${DRUPAL_GID:-41821}
    volumes:
      - .:/var/www/html
    expose:
      - "9000"
    healthcheck:
      test: ["CMD", "php-fpm-healthcheck"]
      interval: 30s
      timeout: 3s
      retries: 3

  nginx:
    image: tavib47/drupal-nginx
    ports:
      - "80:80"
    volumes:
      - ./web:/var/www/html/web:ro
    environment:
      - PHP_FPM_HOST=php
    depends_on:
      php:
        condition: service_healthy

⁠Source

GitHub Repository⁠

Tag summary

Content type

Image

Digest

sha256:caabf3c26…

Size

342.1 MB

Last updated

8 months ago

docker pull tavib47/drupal-php