Skip to content

Instantly share code, notes, and snippets.

@YuukiToriyama
Created June 8, 2021 21:07
Show Gist options
  • Save YuukiToriyama/5ff5a907d9e6611a8f4b89c3535e1d65 to your computer and use it in GitHub Desktop.
Save YuukiToriyama/5ff5a907d9e6611a8f4b89c3535e1d65 to your computer and use it in GitHub Desktop.
PostgresDB + Drupal
version: '3'
services:
drupal:
image: drupal:8-apache
ports:
- 8080:80
volumes:
- /var/www/html/modules
- /var/www/html/profiles
- /var/www/html/sites
- /var/www/html/themes
restart: always
postgres:
image: postgres
environment:
- POSTGRES_PASSWORD=mypasswd
@YuukiToriyama
Copy link
Author

ただし、コンテナを終了する度初期化されてしまうので毎回インストールが必要。

@YuukiToriyama
Copy link
Author

version: "3.7"
services:
  php-apache:
    image: php:8-apache
    networks:
      drupal_net:
    volumes:
      - $PWD/web:/var/www/html/web
      - $PWD/vendor:/var/www/html/vendor

    ports:
      - 8081:80
    depends_on:
      - db
    restart: always
  db:
    image: postgres:13
    environment:
      POSTGRES_DB: $POSTGRES_DB
      POSTGRES_USER: $POSTGRES_USER
      POSTGRES_PASSWORD: $POSTGRES_PASSWORD
    networks:
      drupal_net:
    volumes:
      - postgres-data:/var/lib/postgresql/data
    ports:
      - 5433:5432
    restart: always
networks:
  drupal_net:
    driver: bridge
volumes:
  drupal-modules:
    driver_opts:
      type: none
      device: $PWD/web/modules
      o: bind
  drupal-profiles:
    driver_opts:
      type: none
      device: $PWD/web/profiles
      o: bind
  drupal-themes:
    driver_opts:
      type: none
      device: $PWD/web/themes
      o: bind
  drupal-sites:
    driver_opts:
      type: none
      device: $PWD/web/sites
      o: bind
  postgres-data:
    driver_opts:
      type: none
      device: $PWD/data/postgres
      o: bind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment