{"id":16361927,"url":"https://github.com/wengerk/docker-drupal-for-contrib","last_synced_at":"2025-03-23T02:31:28.300Z","repository":{"id":37090489,"uuid":"275139108","full_name":"WengerK/docker-drupal-for-contrib","owner":"WengerK","description":"Docker images to setup containers on Contributions Modules/Themes for Drupal 8/9/10/11","archived":false,"fork":false,"pushed_at":"2024-09-19T12:06:03.000Z","size":130,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"dev","last_synced_at":"2024-10-12T02:22:25.417Z","etag":null,"topics":["docker","drupal","drupal-module"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/wengerk/drupal-for-contrib","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WengerK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-26T11:23:42.000Z","updated_at":"2024-09-19T12:06:04.000Z","dependencies_parsed_at":"2023-01-29T15:15:49.776Z","dependency_job_id":"4154703c-b0e3-43c5-b0d9-c992a48e641a","html_url":"https://github.com/WengerK/docker-drupal-for-contrib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WengerK%2Fdocker-drupal-for-contrib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WengerK%2Fdocker-drupal-for-contrib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WengerK%2Fdocker-drupal-for-contrib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WengerK%2Fdocker-drupal-for-contrib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WengerK","download_url":"https://codeload.github.com/WengerK/docker-drupal-for-contrib/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221842185,"owners_count":16890124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","drupal","drupal-module"],"created_at":"2024-10-11T02:22:25.148Z","updated_at":"2025-03-23T02:31:28.286Z","avatar_url":"https://github.com/WengerK.png","language":"Dockerfile","readme":"# Drupal Docker Container for Contributions\n\n[![Build Status](https://github.com/WengerK/docker-drupal-for-contrib/actions/workflows/container-structure-test.yml/badge.svg)](https://github.com/WengerK/docker-drupal-for-contrib/actions/workflows/container-structure-test.yml)\n[![Docker Pulls](https://img.shields.io/docker/pulls/wengerk/drupal-for-contrib.svg)](https://hub.docker.com/r/wengerk/drupal-for-contrib)\n[![Docker Stars](https://img.shields.io/docker/stars/wengerk/drupal-for-contrib.svg)](https://hub.docker.com/r/wengerk/drupal-for-contrib)\n\nMany Drupal Docker images exists on [Docker Hub](https://hub.docker.com/search?q=drupal\u0026type=image). So why another image ?\nAll of those images serve the same purpose, **integrate Docker into a complete Drupal project**. \n\nThis image is way different as we don't want to solve the Docker integration with Drupal but give a **solution to setup a Docker on Contributions modules or themes**.\n\nI see way too many developers creating awesome modules and struggling to test them by having to bootstrap a complete clean Drupal 8/9/10/11 environment and symlinks the custom modules/themes inside it.\nWith this Docker image, I want to highly simplify this process by having a containerized Drupal 8/9 used for manual or automated testing of modules/themes Contributions projects.\n\n## Docker Images\n\n❗For better reliability we release images with stability tags (`wengerk/drupal-for-contrib:9.X`) which **does not correspond** to [git tags](https://github.com/wengerk/docker-drupal-for-contrib/releases). We strongly recommend using images only with stability tags. \n\nOverview:\n\n* All images based on the [official Drupal Docker](https://github.com/docker-library/drupal) maintained by: the Docker Community.\n* [Travis CI builds](https://travis-ci.com/github/WengerK/docker-drupal-for-contrib) \n* [Docker Hub](https://hub.docker.com/r/wengerk/drupal-for-contrib)\n\n| Supported tags and respective `Dockerfile` links                                                             | Drupal   |\n|--------------------------------------------------------------------------------------------------------------|----------|\n| `11.2` [_(Dockerfile)_](https://github.com/wengerk/docker-drupal-for-contrib/tree/master/11/11.1/Dockerfile) | 11.x-dev |\n| `11.1` [_(Dockerfile)_](https://github.com/wengerk/docker-drupal-for-contrib/tree/master/11/11.1/Dockerfile) | 11.1.x   |\n| `11.0` [_(Dockerfile)_](https://github.com/wengerk/docker-drupal-for-contrib/tree/master/11/11.0/Dockerfile) | 11.0.x   |\n| `10.5` [_(Dockerfile)_](https://github.com/wengerk/docker-drupal-for-contrib/tree/master/10/10.5/Dockerfile) | 10.5-dev |\n| `10.4` [_(Dockerfile)_](https://github.com/wengerk/docker-drupal-for-contrib/tree/master/10/10.4/Dockerfile) | 10.4.x   |\n| `10.3` [_(Dockerfile)_](https://github.com/wengerk/docker-drupal-for-contrib/tree/master/10/10.3/Dockerfile) | 10.3.x   |\n| `10.2` [_(Dockerfile)_](https://github.com/wengerk/docker-drupal-for-contrib/tree/master/10/10.2/Dockerfile) | 10.2.x   |\n| `10.1` [_(Dockerfile)_](https://github.com/wengerk/docker-drupal-for-contrib/tree/master/10/10.1/Dockerfile) | 10.1.x   |\n| `10.0` [_(Dockerfile)_](https://github.com/wengerk/docker-drupal-for-contrib/tree/master/10/10.0/Dockerfile) | 10.0.x   |\n| `9.5` [_(Dockerfile)_](https://github.com/wengerk/docker-drupal-for-contrib/tree/master/9/9.5/Dockerfile)    | 9.5.x    |\n\n## Usage in a Drupal Contribution Modules/Themes\n\n1. Create a `Dockerfile` file at the root level of your repository\n\n    ```\n    ARG BASE_IMAGE_TAG=10.4\n    FROM wengerk/drupal-for-contrib:${BASE_IMAGE_TAG}\n    ```\n\n2. Create a `docker-compose.yml` file at the root level of your repository\n\n    ```yaml\n    services:\n    \n      drupal:\n        build: .\n        depends_on:\n          - db\n        ports:\n          - 8888:80\n        volumes:\n          # Mount the module in the proper contrib module directory.\n          - .:/opt/drupal/web/modules/contrib/my_module\n        restart: always\n    \n      db:\n        image: mariadb:10.6\n        environment:\n          MYSQL_USER: drupal\n          MYSQL_PASSWORD: drupal\n          MYSQL_DATABASE: drupal\n          MYSQL_ROOT_PASSWORD: root\n        restart: always\n    ```\n    \n    Update the mounted `volume` name to match your custom module name.\n\n3. Run Docker\n\n```shell\n$ docker-compose build --pull --build-arg BASE_IMAGE_TAG=10.4 drupal\n$ docker-compose up -d drupal\n# wait on Docker to be ready, especially MariaDB that takes many seconds to be up before install.\n$ docker-compose exec -u www-data drupal drush site-install standard --db-url=\"mysql://drupal:drupal@db/drupal\" --site-name=Example -y\n```\n\n4. Run PHPUnit testing\n\n```shell\ndocker-compose exec -u www-data drupal phpunit --no-coverage --group=my_module\n```\n\n## Travis Integration example\n\n1. Create a `.travis.yml` file at the root level of your repository\n\n```yaml\nlanguage: php\n\nservices:\n  - docker\n\nenv:\n  global:\n    # The module name to be mounted and tested in the Docker.\n    - MODULE_NAME=\"my_module\"\n\njobs:\n  include:\n    - name: D8.9\n      env: BASE_IMAGE_TAG=\"8.9\"\n    - name: D9.0\n      env: BASE_IMAGE_TAG=\"9.0\"\n    - name: D10.0\n      env: BASE_IMAGE_TAG=\"10.0\"\n    - name: D11.0\n      env: BASE_IMAGE_TAG=\"11.0\"\n\nbefore_install:\n  - docker-compose build --pull --build-arg BASE_IMAGE_TAG=${BASE_IMAGE_TAG} drupal\n  - docker-compose up -d drupal\n  # wait on Docker to be ready, especially MariaDB that takes many seconds to be up.\n  - docker-compose exec drupal wait-for-it drupal:80 -t 60\n  - docker-compose exec drupal wait-for-it db:3306 -t 60\n\nbefore_script:\n  - docker-compose exec -u www-data drupal drush site-install standard --db-url=\"mysql://drupal:drupal@db/drupal\" --site-name=Example -y\n\nscript:\n  - docker-compose exec -u www-data drupal phpunit --no-coverage --group=${MODULE_NAME} --configuration=/opt/drupal/web/phpunit.xml\n```\n\n## Github Actions Integration example\n\n```yaml\nname: Continuous integration\non: [push]\n\njobs:\n  tests:\n    name: Tests\n    runs-on: ubuntu-latest\n\n    strategy:\n      matrix:\n        drupal_version: ['8.9', '9.0', '9.1', '10.0', '10.1', '10.2', '11.0']\n        module: ['my_module']\n        experimental: [ false ]\n        include:\n          - drupal_version: '10.3'\n            module: 'my_module'\n            experimental: true\n          - drupal_version: '11.1'\n            module: 'my_module'\n            experimental: true\n\n    steps:\n      - uses: actions/checkout@v3\n      - run: docker-compose -f docker-compose.yml pull --include-deps drupal\n      - name: Build the docker-compose stack\n        run: docker-compose -f docker-compose.yml build --pull --build-arg BASE_IMAGE_TAG=${{ matrix.drupal_version }} drupal\n        continue-on-error: ${{ matrix.experimental }}\n      - name: Run unit tests\n        run: docker-compose -f docker-compose.yml run -u www-data drupal phpunit --no-coverage --group=${{ matrix.module }} --configuration=/var/www/html/phpunit.xml\n        continue-on-error: ${{ matrix.experimental }}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwengerk%2Fdocker-drupal-for-contrib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwengerk%2Fdocker-drupal-for-contrib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwengerk%2Fdocker-drupal-for-contrib/lists"}