From 7b0274bddb8075f5949553c209dfec9598fdde8b Mon Sep 17 00:00:00 2001 From: Ben Firshman Date: Tue, 18 Feb 2014 10:54:06 +0000 Subject: [PATCH] update --- cli.html | 2 +- django.html | 2 +- env.html | 2 +- index.html | 2 +- install.html | 2 +- rails.html | 2 +- wordpress.html | 22 +++++++++++----------- yml.html | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cli.html b/cli.html index fac0a888..7e2c43db 100644 --- a/cli.html +++ b/cli.html @@ -6,7 +6,7 @@ - +
diff --git a/django.html b/django.html index 3858affc..af1905c2 100644 --- a/django.html +++ b/django.html @@ -6,7 +6,7 @@ - +
diff --git a/env.html b/env.html index ee74be50..67017483 100644 --- a/env.html +++ b/env.html @@ -6,7 +6,7 @@ - +
diff --git a/index.html b/index.html index d8667a73..887de5f4 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ - +
diff --git a/install.html b/install.html index e2e3aa62..6dfe0304 100644 --- a/install.html +++ b/install.html @@ -6,7 +6,7 @@ - +
diff --git a/rails.html b/rails.html index 774066b3..57e58768 100644 --- a/rails.html +++ b/rails.html @@ -6,7 +6,7 @@ - +
diff --git a/wordpress.html b/wordpress.html index 45a60668..c3b5715a 100644 --- a/wordpress.html +++ b/wordpress.html @@ -6,7 +6,7 @@ - +
@@ -19,25 +19,25 @@

Getting started with Fig and Wordpress

-

Fig makes it nice and easy to run Wordpress in an isolated environment. Install Fig, then write a Dockerfile which installs PHP and Wordpress:

+

Fig makes it nice and easy to run Wordpress in an isolated environment. Install Fig, then download Wordpress into the current directory:

+
$ curl http://wordpress.org/wordpress-3.8.1.tar.gz | tar -xvzf -
+
+

This will create a directory called wordpress, which you can rename to the name of your project if you wish. Inside, that directory, we need to write a file that defines what environment your app is going to run in:

FROM orchardup/php5
-
-ADD http://wordpress.org/wordpress-3.8.1.tar.gz /wordpress.tar.gz
-RUN tar -xzf /wordpress.tar.gz
-ADD wp-config.php /wordpress/wp-config.php
-
-ADD router.php /router.php
+ADD . /code
 

This instructs Docker on how to build an image that contains PHP and Wordpress. For more information on how to write Dockerfiles, see the Dockerfile tutorial and the Dockerfile reference.

Next up, fig.yml starts our web service and a separate MySQL instance:

web:
   build: .
-  command: php -S 0.0.0.0:8000 -t /wordpress
+  command: php -S 0.0.0.0:8000 -t /code
   ports:
     - 8000:8000
   links:
     - db
+  volumes:
+    - .:/code
 db:
   image: orchardup/mysql
   ports:
@@ -45,7 +45,7 @@ db:
   environment:
     MYSQL_DATABASE: wordpress
 
-

Our Dockerfile relies on two supporting files - first up, wp-config.php is the standard Wordpress config file with a single change to make it read the MySQL host and port from the environment variables passed in by Fig:

+

Two supporting files are needed to get this working - first up, wp-config.php is the standard Wordpress config file with a single change to make it read the MySQL host and port from the environment variables passed in by Fig:

<?php
 define('DB_NAME', 'wordpress');
 define('DB_USER', 'root');
@@ -90,7 +90,7 @@ if(file_exists($root.$path))
     }
 }else include_once 'index.php';
 
-

With those four files in place, run fig up and it'll pull and build the images we need, and then start the web and database containers. You'll then be able to visit Wordpress and set it up by visiting localhost:8000 - or localdocker:8000 if you're using docker-osx.

+

With those four files in place, run fig up inside your Wordpress directory and it'll pull and build the images we need, and then start the web and database containers. You'll then be able to visit Wordpress and set it up by visiting localhost:8000 - or localdocker:8000 if you're using docker-osx.