Commit e8083520515bc0647eb840408a52e51fa4671475

Golmote 2015-09-05T16:44:38

Merge pull request #576 from JustinBeckwith/gh-pages add dockerfile highlighting

diff --git a/components.js b/components.js
index 4b5d21d..da9732e 100644
--- a/components.js
+++ b/components.js
@@ -123,6 +123,10 @@ var components = {
 			"require": "clike",
 			"owner": "Golmote"
 		},
+		"docker": {
+			"title": "Docker",
+			"owner": "JustinBeckwith"
+		},
 		"eiffel": {
 			"title": "Eiffel",
 			"owner": "Conaclos"
diff --git a/components/prism-docker.js b/components/prism-docker.js
new file mode 100644
index 0000000..ddf909e
--- /dev/null
+++ b/components/prism-docker.js
@@ -0,0 +1,9 @@
+Prism.languages.docker = {
+	'keyword': {
+		pattern: /(^\s*)(?:ONBUILD|FROM|MAINTAINER|RUN|EXPOSE|ENV|ADD|COPY|VOLUME|USER|WORKDIR|CMD|LABEL|ENTRYPOINT)(?=\s)/mi,
+		lookbehind: true
+	},
+	'string': /("|')(\\\n|\\?.)*?\1/,
+	'comment': /#.*/,
+	'punctuation': /([:[\]{}\-,|>?]|---|\.\.\.)/
+};
diff --git a/examples/prism-docker.html b/examples/prism-docker.html
new file mode 100644
index 0000000..a37b2df
--- /dev/null
+++ b/examples/prism-docker.html
@@ -0,0 +1,52 @@
+<h1>Docker</h1>
+<p>To use this language, use the class "language-docker".</p>
+
+<h2>Comments</h2>
+<pre><code># These are the comments for a dockerfile.
+# I want to make sure $(variables) don't break out,
+# and we shouldn't see keywords like ADD or ENTRYPOINT
+</code></pre>
+
+<h2>Full example</h2>
+<pre><code># Nginx
+#
+# VERSION               0.0.1
+
+FROM      ubuntu
+MAINTAINER Victor Vieux <victor@docker.com>
+
+LABEL Description="This image is used to start the foobar executable" Vendor="ACME Products" Version="1.0"
+RUN apt-get update && apt-get install -y inotify-tools nginx apache2 openssh-server
+
+# Firefox over VNC
+#
+# VERSION               0.3
+
+FROM ubuntu
+
+# Install vnc, xvfb in order to create a 'fake' display and firefox
+RUN apt-get update && apt-get install -y x11vnc xvfb firefox
+RUN mkdir ~/.vnc
+# Setup a password
+RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
+# Autostart firefox (might not be the best way, but it does the trick)
+RUN bash -c 'echo "firefox" >> /.bashrc'
+
+EXPOSE 5900
+CMD    ["x11vnc", "-forever", "-usepw", "-create"]
+
+# Multiple images example
+#
+# VERSION               0.1
+
+FROM ubuntu
+RUN echo foo > bar
+# Will output something like ===> 907ad6c2736f
+
+FROM ubuntu
+RUN echo moo > oink
+# Will output something like ===> 695d7793cbe4
+
+# You᾿ll now have two images, 907ad6c2736f with /bar, and 695d7793cbe4 with
+# /oink.
+</code></pre>