GithubHelp home page GithubHelp logo

jedsalazar / rules_apko Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chainguard-dev/rules_apko

0.0 0.0 0.0 243 KB

Bazel rules for apko

Home Page: https://apko.dev

License: Apache License 2.0

Shell 5.62% Starlark 93.36% jq 1.02%

rules_apko's Introduction

Bazel rules for apko

Wraps the https://github.com/chainguard-dev/apko tool for use under Bazel.

Need help? This ruleset has support provided by https://aspect.dev.

Installation

Follow instructions in the release notes from the release you wish to use. Be sure to follow the "Initial Setup" instructions as well. https://github.com/chainguard-dev/rules_apko/releases

To use a commit rather than a release, you can point at any SHA of the repo, using the GitHub-provided source archive like `https://github.com/chainguard-dev/rules_apko/archive/abc123.tar.gz``

Note

Note that GitHub source archives don't have a strong guarantee on the sha256 stability. See https://github.blog/2023-02-21-update-on-the-future-stability-of-source-code-archives-and-hashes/

Usage

Apko usage begins with an apko.yaml configuration file. The apko lock tool will create a corresponding apko.lock.json file, and this is where Bazel will read to fetch external content. Assuming apko_rules are already loaded in your MODULE.bazel or WORKSPACE file one can call: bazel run @rules_apko//apko lock ./apko.yaml to lock the dependencies and generate apko.lock.json file.

Than you import these base layers into Bazel:

  • With Bazel 6 and [bzlmod], call apk.translate_lock in MODULE.bazel
  • Otherwise, call translate_apko_lock in WORKSPACE

Now you can use the apko_image rule to build the image, producing an OCI format output. As long as the apko .yaml file is in the same directory as the apko_image you can periodically refresh the apko.lock.json file by just calling: bazel run path/to/image.lock. Alternatively you can call apko lock path/to/apko.yaml or bazel run @rules_apko//apko lock path/to/apko.yaml to regenerate the apko.lock.json file manually. To resolve all the files in the repository, such a snippet can be useful.

Finally, we recommend using https://github.com/bazel-contrib/rules_oci as the next step in your Bazel build to add application code from your repo as the next layers of the image.

See the examples folder in this repository, which relies on base layers declared in /MODULE.bazel.

Also see the e2e folder in this repository, where we declare our end-to-end test.

Public API

  • translate_lock Repository rules for translating apko.lock.json
  • rules Build OCI images from APK packages directly without Dockerfile

rules_apko's People

Contributors

thesayyn avatar alexeagle avatar sfc-gh-ptabor avatar imjasonh avatar jedsalazar avatar kawfong avatar plobsing 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.