Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dockerfile highlighting #576

Merged
merged 3 commits into from
Sep 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ var components = {
"require": "clike",
"owner": "Golmote"
},
"docker": {
"title": "Docker",
"owner": "JustinBeckwith"
},
"eiffel": {
"title": "Eiffel",
"owner": "Conaclos"
Expand Down
9 changes: 9 additions & 0 deletions components/prism-docker.js
Original file line number Diff line number Diff line change
@@ -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': /([:[\]{}\-,|>?]|---|\.\.\.)/
};
52 changes: 52 additions & 0 deletions examples/prism-docker.html
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>

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>