Coder Social home page Coder Social logo

creative-workflow / wordpress-docker Goto Github PK

View Code? Open in Web Editor NEW
14.0 5.0 1.0 7.33 MB

develop wordpress via docker container, don't pollute your dev system

Nginx 13.29% CoffeeScript 30.79% JavaScript 2.14% Shell 12.46% PHP 41.32%
wordpress docker nodejs browsersync phpmyadmin wordpress-setup gulp-tasks

wordpress-docker's Introduction

CW - Wordpress Development Setup

You will get a running wordpress instance based on the latest wordpress source, a database where the wordpress data will be stored, phpmyadmin for database management and extendible gulp tasks with livereload preconfigured. And this all running inside of docker container so your dev system stays clean =)

Install the following dependencies

Wordpress up and running in 10 minutes

1. Create a folder for your new wordpress project

mkdir my-wp-project && cd my-wp-project

2. Copy source files from this repo

git clone --branch=master https://github.com/creative-workflow/wordpress-docker.git . && rm -rf ./.git*

3. Download a fresh wordpress copy and copy our specific wp-config.php

./scripts/init-wordpress.sh Note: For this script you need to have curl installed. Note: You can copy your own wordpress source code to a folder named 'wordpress' inside of your 'my-wp-project' folder

4. Setup and run the web, db and php container

./scripts/run.sh

Note: At the beginning an info will be printed containing the ip where you can access your wordpress installation. E.g.

 -> starting wordpress web container on: 0.0.0.0:9999
 -> starting phpmyadmin container on: 0.0.0.0:9001
 -> if you want to use browsersync or gulp open another terminal
 -> !db container needs a few minutes first time to setup db
 more info: https://github.com/creative-workflow/wordpress-docker

If you don't want to use browser-sync follow the wordpress setup guide inside of your browser and ignore the following steps.

Note: Sometimes the wordpress setup gets a timeout, but a reload shows the correct installation.

Note: In the terminal where you started the docker machine you can see the requests sent from your browser.

Note: With Ctrl+C you can stop the docker container in the terminal.

5. If you want to use browser-sync

Open a new terminal inside your project folder and run:

npm install -g gulp gulp-cli yarn coffee-script
yarn install

Note: If you have access errors prepend the commands with sudo.

Now you can start browser-sync by typing gulp serve. This will open your standard browser with your wordpress page.

Follow the wordpress setup guide.

Note: With Ctrl+C you can stop browser-sync in the terminal.

Using browser-sync

If you edit e.g. the style.css in my-wp-project/wordpress/wp-content/themes/twentysixteen your browser refreshes automatically.

The browser-sync user interface is accessible via localhost:3002.

Change the watched wordpress theme

If you want to watch another or your own custom wordpress theme, change the settings in my-wp-project/gulp/config.yml and restart with gulp serve.

Manage database

You can share a database dump within your repo, so you can sync development with your team mates. (remember step 3.1)

export your database to ./data/db/dump.sql

./scripts/db-export.sh

import data from ./data/db/dump.sql

./scripts/db-import.sh

using phpmyadmin

Open http://localhost:9001 web browser. Login in with:. Login in with:

  • host: leave blank
  • user: root
  • password: leave blank

Manage container

start web, db, php and phpmyadmin container

./scripts/run.sh

Note: At the first line ip and port for web container access will be printed.

login to a container

docker-compose run web bash

Note: web, db, php and phpmyadmin are available.

container log files

docker-compose logs web

Note: web, db, php and phpmyadmin are available.

delete all containers

Attention: your database will be removed, ensure you dumped it(see above).

docker-compose stop && docker-compose rm

Livereload, Browsersync, Sass and Coffee

Reloads your browser on code changes and compiles sass to css and coffee to javascript. Read more.

It has to run on your local machine because of filesystem event issues.

adding and running gulp tasks

You can add your custom gulp tasks to the files in the folder ./gulp/*.

Read more about gulp.

TODOs

wordpress-docker's People

Contributors

arecords avatar tomhanoldt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

xmarlem

wordpress-docker's Issues

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.