{"id":19448967,"url":"https://github.com/brettgullan/docker-craftcms","last_synced_at":"2026-05-14T18:03:38.940Z","repository":{"id":83250224,"uuid":"152520803","full_name":"brettgullan/docker-craftcms","owner":"brettgullan","description":"Dockerized web stack for Craft CMS projects. Uses Apache (or Nginx), PHP FPM and MySQL.","archived":false,"fork":false,"pushed_at":"2020-04-28T03:40:06.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T23:30:27.009Z","etag":null,"topics":["craft","craft3","craftcms","docker","docker-compose"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brettgullan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-10-11T02:45:46.000Z","updated_at":"2020-04-28T03:40:08.000Z","dependencies_parsed_at":"2023-03-12T17:44:55.123Z","dependency_job_id":null,"html_url":"https://github.com/brettgullan/docker-craftcms","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/brettgullan%2Fdocker-craftcms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brettgullan%2Fdocker-craftcms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brettgullan%2Fdocker-craftcms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brettgullan%2Fdocker-craftcms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brettgullan","download_url":"https://codeload.github.com/brettgullan/docker-craftcms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240636685,"owners_count":19832924,"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":["craft","craft3","craftcms","docker","docker-compose"],"created_at":"2024-11-10T16:29:22.937Z","updated_at":"2026-05-14T18:03:33.902Z","avatar_url":"https://github.com/brettgullan.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DOCKER RUNTIME FOR CRAFT CMS\n\nThis repo provides a basic 'drop-in' web development runtime for Craft CMS.\n\nIt is not intended to provide a production-quality environment, it does not download or install Craft CMS, nor install or update plugins or dependencies, back up your database or any other bells and whistles.\n\n## So what does it do?\n\nThe idea behind this boilerplate is to provide a minimal, but flexible, stack for running a local Craft CMS development environment. Web server, PHP and database.\n\nThe basic `docker-compose.yml` file configures and runs separate Apache, PHP-FPM and MySQL services, using minimal defaults and volume mappings. Just enough to get you going.\n\nThus, with minimal Docker experience, it is easy to reconfigure an environment to use Postgres, or Nginx if desired. Or to add Redis support or whatever else you might need.\n\nCheck out the `use-nginx` branch of this repo for a boilerplate that uses Nginx instead of Apache.\n\n## Motivation\n\nI didn't want to get into highly bespoke or custom image builds. I've always found they're not worth the effort. Environments and technologies change too frequently, and I don't have time to maintain them. I wanted a 'stock' environment that would be easy to update and maintain, and that could be added to existing projects and modified per-project as and when required.\n\nI'm not overly concerned about maintaining production fidelity -- there are simply far too many possibilities to cover. My focus is simply to create a development environment that will run Craft CMS. That said, in my experience PHP is fairly robust. Minor version differences are rarely the cause of issues between environments. So this stack should serve pretty well to be getting started with.\n\n\n# HOW TO USE\n\nClone this repo (or copy-paste into an existing project).\nIf cloning, delete `.git` directory, then run `git init`.\n\n## With an existing Craft CMS install\n\nTo use this boilerplate with an existing Craft CMS configuraiton, clone into a temporary directory, then copy the `docker` directory and `docker-compose.yml` files into your project.\n\nEasiest way to do this is via terminal, from within the cloned `docker-craftcms` directory issue:\n\n```shell\n$ cp -r ./docker* \u003cpath-to-destination-directory\u003e\n```\n\nCreate a `database` directory in the root of your project.\n\n```shell\n$ mkdir database\n```\n\nThis is used to store the internal database data files (used by MySQL or Postgres) from within the Docker container. It allows the database to persist across Docker restarts. Otherwise, any changes to your Craft database tables would be lost.\n\nTo populate the database instance with an existing database dump, add the following line to your `docker-compose.yml` in the database `volumes` configuration:\n\n```yaml\n    - ./sql:/docker-entrypoint-initdb.d\n```\n\nWhere `./sql` is the path to a project directory that contains the database dump file(s).  \nAny `.sql` or `.zip` files (containing `.sql` files) will be processed alphabetically and imported into your database.  \nNote this only occurs on container initialization. \n\nYour database configuration should look like this:\n\n```yaml\n  mysql:\n    image: mariadb:${MYSQL_VERSION:-latest}\n    networks:\n      - backend\n    ports:\n      - \"3306:3306\"\n    environment:\n      MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'\n      MYSQL_USER: ${DB_USER}\n      MYSQL_PASSWORD: ${DB_PASSWORD}\n      MYSQL_DATABASE: ${DB_DATABASE}\n    volumes:\n      - ./docker/mysql/my.cnf:/etc/mysql/conf.d/custom.cnf\n      - ./database:/var/lib/mysql:delegated\n      - ./sql:/docker-entrypoint-initdb.d\n    container_name: db\n```\n\n\nCopy any relevant environment variables from the boilerplate `.env` file to your project's.\n\nNow you should be ready to go. Just run the following from your terminal:\n\n```shell\n$ docker-compose up\n```\n\n## Docker-Compose configuration\n\nWe mount each of the Craft CMS directories into the `php` \nWe map the entire `./` directory to `/var/www` in both the `apache` and `php` environments.\n\nWe also modify the _default_ web directory from `/var/www/html` to `/var/www/web`, simply to be consistent with out-of-the-box Craft CMS conventions.\n\nWe expose the default MySQL database port `3306` so you can connect directly to the running database instance using your favourite database management tool.\n\n## TIPS, TRICKS \u0026 GOTCHAS\n\n## Using Nginx instead of Apache\n\nTo use Nginx instead of Apache, replace the `apache` service definition in `docker-compose.yml` with the following:\n```yaml\n  nginx:\n    image: nginx:alpine\n    ports:\n      - \"80:80\"\n    depends_on:\n      - php\n      - mysql\n    networks:\n      - frontend\n      - backend\n    volumes:\n      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf\n      - .env:/var/www/.env\n      - ./web:/var/www/web\n    links:\n      - php\n    container_name: nginx\n```\n\n## Database\nWhen connecting to the database from within the Docker environment, use the Docker **service name** defined in `docker-compose.yml` -- i.e. `mysql`, not the usual `localhost` or `127.0.0.1`.\n\n## Docker\n\nWhen you really, really need to shut everything down ...\n```shell\n  docker-compose stop\n  docker-compose kill\n  docker-compose rm -f\n```\n\n# TODO\n\nAdd Redis support\nAdditional helper scripts:  \n * To configure project;\n * To initialize database (from arbitrary .sql file)\n\n# REFERENCES\n\nhttps://github.com/prooph/docker-files/blob/master/php/7.4-fpm  \nhttps://github.com/mzazon/php-apache-mysql-containerized/blob/master/README.md  \nhttp://www.inanzzz.com/index.php/post/su76/creating-apache-mysql-and-php-fpm-containers-for-a-web-application-with-docker-compose","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrettgullan%2Fdocker-craftcms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrettgullan%2Fdocker-craftcms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrettgullan%2Fdocker-craftcms/lists"}