This project provides Dockerfile syntax extensions that have been rejected by the moby project or haven't been addressed in a long time.
This project provides useful Dockerfile syntax extensions that have been rejected by the moby project or haven't been addressed in a long time.
Currently, the project adds an `INCLUDE+` Dockerfile directive that allows you to import the content of another file into your Dockerfile. There are plans to add more features in the near future.
- [Getting started](#getting-started)
- [Getting started](#getting-started)
- [Features](#features)
- [Features](#features)
- [INCLUDE+](#include)
- [INCLUDE+](#include)
- [ENVFILE+](#envfile)
- [Roadmap](#roadmap)
- [Roadmap](#roadmap)
- [Feedback](#feedback)
- [Feedback](#feedback)
@ -27,9 +26,9 @@ That's it!
## Features
## Features
### INCLUDE+
Note: All Dockerfile+ commands will end up with a `+` sign to avoid any potential future collisions with Dockerfile commands.
Right now there is just one extra instruction: `INCLUDE+`. All Dockerfile+ commands will end up with a `+` sign to avoid any potential future collisions with Dockerfile commands.
### INCLUDE+
`INCLUDE+` will import the verbatim contents of another file into your Dockerfile. Here's an example Dockerfile which uses the `INCLUDE+` instruction:
`INCLUDE+` will import the verbatim contents of another file into your Dockerfile. Here's an example Dockerfile which uses the `INCLUDE+` instruction:
@ -54,11 +53,45 @@ RUN echo "Hello World"
ENTRYPOINT [ "mybin" ]
ENTRYPOINT [ "mybin" ]
```
```
### ENVFILE+
docker-compose has had support for envfiles for a while now, but Dockerfile hasn't. The `ENVFILE+` instruction brings that support to Dockerfile! If you `ENVFILE+` a .env file, each line will be treated as an `ENV` definition. Here's an example:
```Dockerfile
# syntax = edrevo/dockerfile-plus
FROM alpine
ENVFILE+ prod.env
ENTRYPOINT [ "mybin" ]
```
If prod.env has the following:
```env
FOO=Hello
BAR=World
```
The resulting Docker image would be equivalent to the one generated by this standard Dockerfile:
```Dockerfile
# syntax = edrevo/dockerfile-plus
FROM alpine
ENV FOO=Hello
ENV BAR=World
ENTRYPOINT [ "mybin" ]
```
## Roadmap
## Roadmap
The next features in line would be:
The next features in line would be:
- `ENVFILE+` command, which would read a .env file and import all of those environment variable definitions into the Dockerfile
- `RUN+ --no-cache`, which would disable the cache only for a specific RUN step (useful for non-idempotent commands, for example those that clone git repos)
- `RUN+ --no-cache`, which would disable the cache only for a specific RUN step (useful for non-idempotent commands, for example those that clone git repos)
- `TAG` command
- `TAG` command
- improvements to .dockerignore, like recursive dockerignore files
- improvements to .dockerignore, like recursive dockerignore files
.with_context(||format!("Could not read file \"{}\". Remember that the file path is relative to the build context, not the Dockerfile path.",file_path))?;
.with_context(||format!("Could not read file \"{}\". Remember that the file path is relative to the build context, not the Dockerfile path.",file_path))?;
.with_context(||format!("Could not read file \"{}\". Remember that the file path is relative to the build context, not the Dockerfile path.",file_path))?;