Another version of the WordPress development environment (docker, wp-cli)

There are official images for deploying WordPress and using wp-cli. But when they were used together, I had to share the entire WordPress folder and wanted more options for customizing the installation.







I really wanted to see the browser in the browser, not an invitation to choose the installation language, but a finished site.







This article offers one way to deploy WordPress sites.







Installation



git clone https://github.com/eustatos/wordpress-docker-dev-env.git
      
      





or if you prefer ssh



:







 git clone git@github.com:eustatos/wordpress-docker-dev-env.git
      
      





Then:







 cd wordpress-docker-dev-env docker-compose up -d docker-compose exec -T wp-cli sh < install.sh
      
      





This completes the installation. Open localhost:8080



in your preferred browser.

Access to admin panel localhost:8080/wp-admin



.

User Login - admin





User Password - 123









You can change these and other environment and installation variables in the site.env



and .env



.







The wp-content



folder appears in the project folder, where you can create and / or change themes and plugins.







If there are problems with file permissions in the wp-content



folder:







 sudo usermod -a -G www-data $USER
      
      





Assembly customization



You can control the assembly as conveniently. For example, if you do not need to create themes and / or plugins by default, just make changes to install.sh



.







 #!/usr/bin/env bash wp core download --force --allow-root wp config create \ --dbhost=$WORDPRESS_DB_HOST \ --dbname=$WORDPRESS_DB_NAME \ --dbuser=$WORDPRESS_DB_USER \ --dbpass=$WORDPRESS_DB_PASSWORD \ --allow-root wp core install \ --title=$TITLE \ --url=$URL \ --admin_user=$ADMIN_USER \ --admin_password=$ADMIN_PASSWORD \ --admin_email=$ADMIN_EMAIL \ # add for skip creation default themes --skip-themes # add for skip creation default plugins --skip-plugins --allow-root
      
      





You can learn more about the capabilities of wp core install





here







Topic Creation Example



For example, to create an underscores



based theme, run the following command







 docker-compose exec -T wp-cli wp scaffold _s \ sample-theme \ --theme_name="Sample Theme" \ --author="John Doe"
      
      





This command will create a sample-theme



folder in the wp-content



folder with the theme files and you can immediately start modifying it.







In conclusion, a short video for clarity:










All Articles