Skip to content

Commit e808352

Browse files
committed
Merge pull request #576 from JustinBeckwith/gh-pages
add dockerfile highlighting
2 parents 89cd5d0 + 9020d78 commit e808352

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

components.js

+4
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ var components = {
123123
"require": "clike",
124124
"owner": "Golmote"
125125
},
126+
"docker": {
127+
"title": "Docker",
128+
"owner": "JustinBeckwith"
129+
},
126130
"eiffel": {
127131
"title": "Eiffel",
128132
"owner": "Conaclos"

components/prism-docker.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Prism.languages.docker = {
2+
'keyword': {
3+
pattern: /(^\s*)(?:ONBUILD|FROM|MAINTAINER|RUN|EXPOSE|ENV|ADD|COPY|VOLUME|USER|WORKDIR|CMD|LABEL|ENTRYPOINT)(?=\s)/mi,
4+
lookbehind: true
5+
},
6+
'string': /("|')(\\\n|\\?.)*?\1/,
7+
'comment': /#.*/,
8+
'punctuation': /([:[\]{}\-,|>?]|---|\.\.\.)/
9+
};

examples/prism-docker.html

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<h1>Docker</h1>
2+
<p>To use this language, use the class "language-docker".</p>
3+
4+
<h2>Comments</h2>
5+
<pre><code># These are the comments for a dockerfile.
6+
# I want to make sure $(variables) don't break out,
7+
# and we shouldn't see keywords like ADD or ENTRYPOINT
8+
</code></pre>
9+
10+
<h2>Full example</h2>
11+
<pre><code># Nginx
12+
#
13+
# VERSION 0.0.1
14+
15+
FROM ubuntu
16+
MAINTAINER Victor Vieux <victor@docker.com>
17+
18+
LABEL Description="This image is used to start the foobar executable" Vendor="ACME Products" Version="1.0"
19+
RUN apt-get update && apt-get install -y inotify-tools nginx apache2 openssh-server
20+
21+
# Firefox over VNC
22+
#
23+
# VERSION 0.3
24+
25+
FROM ubuntu
26+
27+
# Install vnc, xvfb in order to create a 'fake' display and firefox
28+
RUN apt-get update && apt-get install -y x11vnc xvfb firefox
29+
RUN mkdir ~/.vnc
30+
# Setup a password
31+
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
32+
# Autostart firefox (might not be the best way, but it does the trick)
33+
RUN bash -c 'echo "firefox" >> /.bashrc'
34+
35+
EXPOSE 5900
36+
CMD ["x11vnc", "-forever", "-usepw", "-create"]
37+
38+
# Multiple images example
39+
#
40+
# VERSION 0.1
41+
42+
FROM ubuntu
43+
RUN echo foo > bar
44+
# Will output something like ===> 907ad6c2736f
45+
46+
FROM ubuntu
47+
RUN echo moo > oink
48+
# Will output something like ===> 695d7793cbe4
49+
50+
# You᾿ll now have two images, 907ad6c2736f with /bar, and 695d7793cbe4 with
51+
# /oink.
52+
</code></pre>

0 commit comments

Comments
 (0)