Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edrevo/dockerfile-plus
New commands for Dockerfile
https://github.com/edrevo/dockerfile-plus
buildkit docker dockerfile llb
Last synced: 3 months ago
JSON representation
New commands for Dockerfile
- Host: GitHub
- URL: https://github.com/edrevo/dockerfile-plus
- Owner: edrevo
- License: apache-2.0
- Created: 2020-12-30T21:13:24.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-20T10:57:03.000Z (over 2 years ago)
- Last Synced: 2024-07-20T02:28:30.166Z (4 months ago)
- Topics: buildkit, docker, dockerfile, llb
- Language: Rust
- Homepage:
- Size: 71.3 KB
- Stars: 239
- Watchers: 6
- Forks: 28
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# Dockerfile+
This project provides 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)
- [Features](#features)
- [INCLUDE+](#include)
- [Roadmap](#roadmap)
- [Feedback](#feedback)## Getting started
- First, you need to make sure you are running a compatible version of Docker: you need at least Docker 18.09. If you are using an older version, you are out of luck. Sorry!
- Export the following environment variables to enable Buildkit: `DOCKER_BUILDKIT=1` and `COMPOSE_DOCKER_CLI_BUILD=1` (this might not be necessary for newer installations of Docker)Once your Docker is set, you just need to add the following line as your first line in your Dockerfile:
```Dockerfile
# syntax = edrevo/dockerfile-plus
```That's it!
## Features
### INCLUDE+
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+` will import the verbatim contents of another file into your Dockerfile. Here's an example Dockerfile which uses the `INCLUDE+` instruction:
```Dockerfile
# syntax = edrevo/dockerfile-plusFROM alpine
INCLUDE+ Dockerfile.common
ENTRYPOINT [ "mybin" ]
```If Dockerfile.common contained a single line that said `RUN echo "Hello World"`, then the resulting Docker image would be identical to the one generated by this Dockerfile:
```Dockerfile
FROM alpineRUN echo "Hello World"
ENTRYPOINT [ "mybin" ]
```## Roadmap
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)
- `TAG` command
- improvements to .dockerignore, like recursive dockerignore files## Feedback
Found a bug? Want to contribute a PR? Want to improve documentation or add a cool logo for the project? All contributions are welcome!
### Development environment
Install cargo (you can use [rustup.rs](https://rustup.rs/)) and run:
```bash
$ cargo build
```### Creating a local release of the Buildkit frontend
```bash
$ docker build -f dockerfile-plus/Dockerfile .
```### Creating multi-arch build
- Enable Experiment in docker config. Add {"experimental": true} to docker daemon.json
- Setup BuildKit local build container
```
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name multiarch --driver docker-container --use
docker buildx inspect --bootstrap
```
- Run following to start multi-arch build
```
docker buildx build \
--platform linux/arm64/v8,linux/amd64 \
--tag edrevo/dockerfile-plus:latest \
-f dockerfile-plus/Dockerfile \
--load ## or --push to push DockerHub \
.
```