Browse Source

Add some official docker-compose.yml scaffolding

This includes an example `docker-compose.yml` for WordPress.
Tianon Gravi 10 years ago
parent
commit
816691a066
5 changed files with 51 additions and 0 deletions
  1. 5 0
      .template-helpers/compose.md
  2. 13 0
      update.sh
  3. 18 0
      wordpress/README.md
  4. 4 0
      wordpress/content.md
  5. 11 0
      wordpress/docker-compose.yml

+ 5 - 0
.template-helpers/compose.md

@@ -0,0 +1,5 @@
+... via [`docker-compose`](https://github.com/docker/compose)
+
+Example `docker-compose.yml` for `%%REPO%%`:
+
+%%COMPOSE-YML%%

+ 13 - 0
update.sh

@@ -93,6 +93,13 @@ for repo in "${repos[@]}"; do
 			logo="![logo](https://raw.githubusercontent.com/docker-library/docs/master/$repo/logo.png)"
 		fi
 		
+		compose=
+		composeYml=
+		if [ -f "$repo/docker-compose.yml" ]; then
+			compose="$(cat "$repo/compose.md" 2>/dev/null || cat "$helperDir/compose.md")"
+			composeYml="$(sed 's/^/\t/' "$repo/docker-compose.yml")"
+		fi
+		
 		cp -v "$helperDir/template.md" "$repo/README.md"
 		
 		echo '  TAGS => generate-dockerfile-links-partial.sh'
@@ -105,6 +112,12 @@ for repo in "${repos[@]}"; do
 		echo "  LOGO => $logo"
 		replace_field "$repo" 'LOGO' "$logo" '\s*'
 		
+		echo '  COMPOSE => '"$repo"'/compose.md'
+		replace_field "$repo" 'COMPOSE' "$compose"
+		
+		echo '  COMPOSE-YML => '"$repo"'/docker-compose.yml'
+		replace_field "$repo" 'COMPOSE-YML' "$composeYml"
+		
 		echo '  DOCKER-VERSIONS => '"$repo"'/docker-versions.md'
 		replace_field "$repo" 'DOCKER-VERSIONS' "$dockerVersions"
 		

+ 18 - 0
wordpress/README.md

@@ -38,6 +38,24 @@ If you'd like to use an external database instead of a linked `mysql` container,
 	docker run --name some-wordpress -e WORDPRESS_DB_HOST=10.1.2.3:3306 \
 	    -e WORDPRESS_DB_USER=... -e WORDPRESS_DB_PASSWORD=... -d wordpress
 
+## ... via [`docker-compose`](https://github.com/docker/compose)
+
+Example `docker-compose.yml` for `wordpress`:
+
+	wordpress:
+	  image: wordpress
+	  links:
+	    - db:mysql
+	  ports:
+	    - 8080:80
+	
+	db:
+	  image: mariadb
+	  environment:
+	    MYSQL_ROOT_PASSWORD: example
+
+Run `docker-compose up`, wait for it to initialize completely, and visit `http://localhost:8080` or `http://host-ip:8080`.
+
 # Supported Docker versions
 
 This image is officially supported on Docker version 1.5.0.

+ 4 - 0
wordpress/content.md

@@ -30,3 +30,7 @@ If you'd like to use an external database instead of a linked `mysql` container,
 
 	docker run --name some-wordpress -e WORDPRESS_DB_HOST=10.1.2.3:3306 \
 	    -e WORDPRESS_DB_USER=... -e WORDPRESS_DB_PASSWORD=... -d wordpress
+
+## %%COMPOSE%%
+
+Run `docker-compose up`, wait for it to initialize completely, and visit `http://localhost:8080` or `http://host-ip:8080`.

+ 11 - 0
wordpress/docker-compose.yml

@@ -0,0 +1,11 @@
+wordpress:
+  image: wordpress
+  links:
+    - db:mysql
+  ports:
+    - 8080:80
+
+db:
+  image: mariadb
+  environment:
+    MYSQL_ROOT_PASSWORD: example