Code Monkey home page Code Monkey logo

wordpress-cli's Introduction

wordpress-cli

This image uses the official wordpress docker image and then rebuild to bundle with WordPress CLI and other software packages. For Development use only! Do not ship in production but instead use the official image or better its alphine version.

The following packages that where added:
  • WP CLI
  • vim
  • curl
  • git
  • zsh with oh-my-zsh
    • included zsh plugins: zsh-syntax-highlighting and zsh-autosuggestions
  • pygments

Usage

Creating a container alone with this image will not run your wordpress app. Subsequently you must include a database and then link it to your wordpress container.

TL;DR;

mkdir -p your-project-folder/www && \
cd  your-project-folder && \
docker run --name your-wp-mysql-name -e MYSQL_DATABASE=wordpress -e MYSQL_ROOT_PASSWORD=root -e MYSQL_USER=wordpress -e MYSQL_PASSWORD=wordpress -d mysql:5.7 && \ 
docker run --name your-wp-name -it --link your-wp-mysql-name -p 80:80 -v "$PWD/www":/var/www/html -e WORDPRESS_DB_HOST=your-wp-mysql-name:3306 -e WORDPRESS_DB_USER=wordpress -e WORDPRESS_DB_PASSWORD=wordpress -d itumulak/wordpress-cli

Creating your stack with docker-compose.

With docker-compose, it is easy to build and maintain our stack this way.

mkdir -p your-project-folder/www && \
cd  your-project-folder && \
curl -o docker-compose.yml https://gist.githubusercontent.com/itumulak/7b6d865ce7915ee8831c00f927693964/raw/docker-compose.yml

Compare the configuration you see below and modify your YML file as needed.

version: '2'

services:
   db:
     image: mysql:5.7
     volumes:
       - ./db:/docker-entrypoint-initdb.d
       - ./db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: root
       MYSQL_DATABASE: wordpress

       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: itumulak/wordpress-cli:latest
     volumes:
        - ./www:/var/www/html
     ports:
       - 80:80
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress

   phpmyadmin:
    depends_on:
      - db
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - 8000:80
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: root
volumes:
    db_data:

Then:

docker-compose up -d

If everything goes well, you can go to http://localhost and do the wordpress setup.

Bash into the container with zsh

docker exec -it your-container-name zsh

Executing WP CLI commands

docker exec -it your-container-name wp --allow-root --info

For a full list of the commands check their documentation.

wordpress-cli's People

Contributors

itumulak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.