Giter Site home page Giter Site logo

zichenlbl / layercake Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tommy351/layercake

0.0 0.0 0.0 160 KB

A command line tool for building complex Docker images.

License: MIT License

Shell 20.71% Go 78.53% Makefile 0.62% Dockerfile 0.14%

layercake's Introduction

Layercake

Build Status Build status codecov

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.

Installation

You can install Layercake with one of the methods below:

Install Script

curl -sL https://github.com/tommy351/layercake/raw/master/install.sh | sh

Docker

https://hub.docker.com/r/tommy351/layercake/

docker run -it --rm \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -v $(pwd):/src \
  -w /src \
  tommy351/layercake

go get

go get -d github.com/tommy351/layercake

Getting Started

Clone the examples.

git clone https://github.com/tommy351/layercake

Change to the example directory.

cd examples/hello_world

Build images.

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.

# 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

layercake's People

Contributors

tommy351 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.