Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
Update parser README regarding inline comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yiranwang52 authored Dec 5, 2018
1 parent aee6bb3 commit d10c012
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions lib/parser/dockerfile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,44 @@ Variable substitutions can be specified in the following formats:

If a variable fails to resolve, it is passed through to the resulting string exactly as it appears in the input.

# Inline comments and backslash

Makisu supports inline comments and backslashes in general, but not if the comment is between multiple lines of one RUN directive separated by backslash. For example, these instructions are supported:
```
# Print hello
RUN echo \
hello
# Print world
RUN echo \
world
```
```
RUN echo \
hello # Print hello
RUN echo \
world # Print world
```
```
# Print hello
RUN echo \
hello
# Print world
RUN echo \
world
```
But the following is not supported:
```
RUN echo \
# Print hello
hello
```
This is because `#!COMMIT` is a special keyword for Makisu, we don't know how to handle it if `#!COMMIT` is placed in the middle of a RUN directive; Besides, backslash is supposed to mean "ignore next character" in bash, so the above example is supposed to be equivalent to:
```
RUN echo # Print hello
hello
```
It doesn't seem reasonable to accept such a Dockerfile.

# Directives

The following directives are not supported: ONBUILD, HEALTHCHECK, and SHELL.
Expand Down

0 comments on commit d10c012

Please sign in to comment.