Docker based build for portability (#8)
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..c6038b4
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,3 @@
+.git
+_site/*
+site-content
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..99a88f6
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,11 @@
+FROM ruby:2.2.5
+
+RUN apt-get update && \
+ apt-get install -y rsync
+
+RUN gem install jekyll -v 1.5.1 && \
+ gem install rdiscount
+
+ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
+
+WORKDIR /jclouds-site
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e8ba9c5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+IMAGE := jclouds/site-builder
+MOUNTPOINT := /jclouds-site
+
+image: ## Build the Docker image with all requirements to build and publish the sire
+ docker build -t $(IMAGE) .
+
+build: ## Build and run the site locally
+ docker run --rm -v "${PWD}:$(MOUNTPOINT)" -p 4000:4000 $(IMAGE) jekyll serve --safe --port 4000
+
+publish: ## Publish the site to https://jclouds.apache.org
+ rm -rf site-content
+ docker run --rm -ti -v "${PWD}:$(MOUNTPOINT)" $(IMAGE) bash deploy-site.sh
+
+help: ## Display this help
+ @awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n\nAvailable targets:\n"} \
+ /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
+
+.PHONY:
+ image build publish help
diff --git a/README.md b/README.md
index d2cb5d9..d820692 100644
--- a/README.md
+++ b/README.md
@@ -2,13 +2,20 @@
This repository supports the GitHub Pages site for jclouds. See and read more at [http://www.jclouds.org](http://www.jclouds.org).
-To test the site locally:
+To test the site locally you will need to create the site build image with:
- jekyll _1.5.1_ serve --safe
+```bash
+make image
+```
-To deploy the site:
+Once you have the build image you can use the following command to build and test the site locally:
-* Ensure you have [jekyll](http://jekyllrb.com/docs/installation/) 1.5.1 installed: `gem install jekyll -v 1.5.1` (it will require an old Ruby such as 2.2.5)
-* If necessary, clone this repository
-* Run `sh ./deploy-site.sh [$uid] [$pwd]` from the repository root. Here, `$uid` is your ASF account ID and `$pwd` your ASF password. If you do not supply your account ID or password, you will be prompted for them
+```bash
+make build
+```
+To deploy the site and make it live run:
+
+```bash
+make publish
+```
diff --git a/deploy-site.sh b/deploy-site.sh
index de4bdc1..d2bb337 100755
--- a/deploy-site.sh
+++ b/deploy-site.sh
@@ -19,7 +19,15 @@
jekyll _${JEKYLL_VERSION}_ build --safe
if [ ! -d "site-content" ]; then
- svn co https://svn.apache.org/repos/asf/jclouds/site-content
+ # Selectively checkout so we don't clone the entire javadocs that are not required here
+ svn co https://svn.apache.org/repos/asf/jclouds/site-content --depth immediates
+ cd site-content
+ find . -maxdepth 1 -type d -not -name 'reference' -not -name '.' -not -name '.svn' | (while read D; do svn up "${D}" --set-depth infinity; done)
+ svn up reference --set-depth immediates
+ cd reference
+ find . -maxdepth 1 -type d -not -name 'javadoc' -not -name '.' | (while read D; do svn up "${D}" --set-depth infinity; done)
+ svn up javadoc --set-depth files
+ cd ../..
else
svn up site-content
fi
@@ -57,11 +65,6 @@
USERNAME_ARG="--username $1"
fi
- PASSWORD_ARG=""
- if [ -n "$2" ]; then
- PASSWORD_ARG="--password $2"
- fi
-
- svn commit --no-auth-cache $USERNAME_ARG $PASSWORD_ARG --message 'deploy jclouds site content'
+ svn commit --no-auth-cache $USERNAME_ARG --message 'deploy jclouds site content'
fi
fi