Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tommy351/layercake
A command line tool for building complex Docker images.
https://github.com/tommy351/layercake
cli docker golang
Last synced: about 1 month ago
JSON representation
A command line tool for building complex Docker images.
- Host: GitHub
- URL: https://github.com/tommy351/layercake
- Owner: tommy351
- License: mit
- Created: 2018-10-27T10:14:17.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-22T16:25:04.000Z (over 5 years ago)
- Last Synced: 2024-10-11T20:48:08.466Z (2 months ago)
- Topics: cli, docker, golang
- Language: Go
- Homepage:
- Size: 156 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Layercake
[![Build Status](https://travis-ci.org/tommy351/layercake.svg?branch=master)](https://travis-ci.org/tommy351/layercake) [![Build status](https://ci.appveyor.com/api/projects/status/633jdcuxr61er2yx/branch/master?svg=true)](https://ci.appveyor.com/project/tommy351/layercake/branch/master) [![codecov](https://codecov.io/gh/tommy351/layercake/branch/master/graph/badge.svg)](https://codecov.io/gh/tommy351/layercake)
Layercake is a command line tool for building complex Docker images. It can export layers from images and import them to other images easily. It's useful when you are trying to build some images with many dependencies.
![](docs/import_layer.svg)
## Installation
You can install Layercake with one of the methods below:
### Install Script
```sh
curl -sL https://github.com/tommy351/layercake/raw/master/install.sh | sh
```### Docker
```sh
docker run -it --rm \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v $(pwd):/src \
-w /src \
tommy351/layercake
```### go get
```sh
go get -d github.com/tommy351/layercake
```## Getting Started
Clone the examples.
```sh
git clone https://github.com/tommy351/layercake
```Change to the example directory.
```sh
cd examples/hello_world
```Build images.
```sh
layercake build
```## Configuration
You can specify the path of config files by adding `--config` option, or it looks for config files in one of the following paths from the current working directory:
- `layercake.yml`
- `layercake.yaml`The following is an example of a config file.
```yaml
# List all images to be built
# You don't have to sort the builds by their dependencies. Layercake resolves
# dependencies and builds images in order.
build:
foo:
# Base image (required)
from: alpine
# Image tags (optional)
tags:
- fooapp:tag
- tommy351/fooapp:tag
# Build arguments (optional)
args:
foo: bar
# A list of images used for cache resolution (optional)
cache_from:
- alpine
# Image labels (optional)
labels:
foo: bar
# Build scripts (required)
# Just like Dockerfile
scripts:
# You can use a string
- RUN echo hello
# Or a map
- run: echo hello
# The value can be any type
- env:
VERSION: 1.2.3
# Import other layers from other builds
- import: bar
bar:
from: busybox
scripts:
- run: echo bar
```## FAQ
### Why not a plain Dockerfile?
Cache doesn't work when you try to modify one of lines in Dockerfile. You have to sort scripts to make sure the cache can do the best effort.
### How about multi-stage builds?
It can be difficult to read if there are too many stages in Dockerfile. Also, you have to remember paths to copy from other stages.
## License
MIT