Skip to content

Dockpress is a Docker-based basic PHP development environment designed for WordPress applications.

License

Notifications You must be signed in to change notification settings

eleftrik/dockpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dockpress

dockpress

GitHub stars GitHub watchers GitHub issues GitHub GitHub tag (latest by date)

Dockpress is a Docker-based basic LEMP development environment designed for WordPress applications.

Looking for a similar Docker environment for Laravel? Then give a try to Laradhoc!

Preferisci leggere in italiano? 🇮🇹

Features

  • Nginx
  • PHP (7.2 / 7.3 / 7.4) with OPCache
  • MySQL / MariaDB
  • Mailhog
  • Redis
  • Custom domain name (e.g. http://mydockpress.test)

You can choose which version of PHP (for example, 7.4) to run by setting ${PHP_VERSION} variable in your .env file (see .env.example for details).

Likewise, you can choose your database (for example, MariaDB 10.2) by setting ${DATABASE_IMAGE} variable in your .env file (see .env.example for details)

In case you want to customize your Docker configuration (e.g. adding some mount), just run cp docker-compose.yml docker-compose.override.yml then edit your docker-compose.override.yml. It will be used by Docker.

Requirements

  • MacOS, Linux or Windows with WSL
  • Docker

Installation

Just clone this repo.

Let's pretend your WordPress application will be accessible at mydockpress.test:

git clone git@github.com:eleftrik/dockpress.git mydockpress.test
cd mydockpress.test

Configuration

.env

Create an .env file from .env.example

cp .env.example .env

# Customize every variable according to your needs
# See comments to each variable in .env.example file 

Custom domain

According to the value of ${APP_HOST}, add your test domain (e.g. mydockpress.test) to your hosts file

sudo /bin/bash -c 'echo -e "127.0.0.1 mydockpress.test" >> /etc/hosts'

Let's go

Build all Docker containers and start them

 .docker/scripts/init

New WordPress project starting from the scratch? No problem, just run:

.docker/scripts/wp-install

A fresh WordPress installation will be downloaded in ${APP_SRC}, configured and available at http://${APP_HOST} or https://${APP_HOST}

Finished working? Just stop everything:

.docker/scripts/stop

Next time you need to run your application, if you haven't changed any setting, just run

 .docker/scripts/start

Updates

When updating from a previous version, follow these steps:

  • update your code

    • via git pull if you're still referencing this repository, a fork or a private one
    • manually downloading the desired release

    In both cases, the src/ folder won't be affected

  • see CHANGELOG.md

  • update your ./.env file according to ./.env.example (new variables may have been introduced)

  • if you have overridden docker-compose.yml using docker-compose.override.yml, see docker-compose.yml to check if something has added, changed or deleted, compared to the previous version of docker-compose.yml you were using before updating

  • launch .docker/scripts/start --build

Scripts

Dockpress provides some useful script, located in .docker/scripts.

Run them from your Dockpress base folder.

init

.docker/scripts/init

It's a shortcut to

docker-compose up -d --build

It will build and start the containers

start

.docker/scripts/start

It's a shortcut to

docker-compose up -d

You can add the flag --build if you want to build the images, otherwise

.docker/scripts/start

is enough to bring up the environment

stop

Tired of working? Stop the environment

.docker/scripts/stop

wp-install

It's useful to bring up a new WordPress project. It will prepare a fresh WordPress installation in your ${APP_SRC}, create a ${APP_SRC}/.env file holding the same values which are in the main .env file, create a ${APP_SRC}/wp-config.php file which uses the aforementioned .env file

.docker/scripts/wp-install

nah

Want to throw away anything? This command will stop all containers, delete volumes and the entire $APP_SRC.

So, before executing this command, BE SURE you understood very well that you're going to lose all your WordPress codebase and the related database!

.docker/scripts/nah

To throw away anything and start again from the scratch, use

.docker/scripts/nah && .docker/scripts/init && .docker/scripts/wp-install

Accessing the database

You can connect to your database via command line or using a tool.

For example, from the command line:

source .env
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -h127.0.0.1 $MYSQL_DATABASE

I bet you prefer to use your favorite tool, for example:

  • TablePlus
  • SequelPro
  • HeidiSQL

etc.

Just use the parameters stored in your .env file.

MailHog

To catch all outgoing emails via MailHog, install a WordPress plugin (e.g. WP Mail SMTP) and use this configuration:

  • SMTP host=mailhog
  • SMTP port=1025
  • SMTP username=(leave blank)
  • SMTP password=(leave blank)

MailHog web interface is available at

http://${APP_HOST}:${MAILHOG_PORT}

For example: http://mydockpress.test:8081

Contributing

Suggestions, reviews, bug reports are very welcome. We never stop learning :-)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Thanks

Thanks to Mauro Cerone for the inspiration

License

MIT

About

Dockpress is a Docker-based basic PHP development environment designed for WordPress applications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published