Création d'un environnement docker pour Drupal

Par ghislain , 22 septembre, 2024

Objectif

L'objectif est de déployer simplement un Drupal sur une machine Linux sans pour autant avoir un Apache et un Postgres qui tourne en continu sur le poste.

Bien entendu on présuppose que Docker est déjà installé sur la machine.

Fichier docker-compose.yml

# Drupal with PostgreSQL
#
# Access via "http://localhost:80"
#   (or "http://$(docker-machine ip):80" if using docker-machine)
#

version: '3.1'

services:
  drupal:
    image: drupal:10-apache
    depends_on:
      postgres:
        condition: service_started
        restart: true
    ports:
      - 80:80
    volumes:
      - drupalmodules:/var/www/html/modules
      - drupalprofiles:/var/www/html/profiles
      - drupalthemes:/var/www/html/themes
      - drupalsites:/var/www/html/sites
    networks:
        - appnetwork
    restart: no

  postgres:
    image: postgres:16
    # set shared memory limit when using docker-compose
    shm_size: 128mb
    environment:
        POSTGRES_PASSWORD: drupalpassword
        POSTGRES_USER: drupaluser
        POSTGRES_DB: drupaldb
        PGDATA: /var/lib/postgresql/data/pgdata
    volumes:
        - postgresdata:/var/lib/postgresql/data
    networks:
        - appnetwork
    restart: no

networks:
    appnetwork:
       driver: bridge
       ipam:
           config:
               - subnet: 10.5.0.0/16
                 gateway: 10.5.0.1
volumes:
    drupalmodules:
    drupalprofiles:
    drupalthemes:
    drupalsites:
    postgresdata:

 

 

Étiquettes

Commentaires