Giter Club home page Giter Club logo

sonar's Introduction

Project Status

Note: This repository is currently not under active development. While the code and documentation remain accessible for reference and educational purposes, there will be no regular updates, bug fixes, or feature additions in the foreseeable future.

If you encounter issues or have questions, you are welcome to open an issue or a pull request. However, please be aware that responses and reviews may be significantly delayed.

Thank you for your understanding and interest in this project.

Sonar ๐Ÿณ

Work with multiple Docker images easily.

Sonar is currently Work in Progress!

What is Sonar

Sonar is a tool that allows you to easily produce, template, build and publish Dockerfiles and Docker images. It uses a declarative, multi-stage approach to build Docker images.

Quick start

Sonar can be used as a Python module or as a standalone program. Sonar will look for an inventory.yaml file in your local directory that should contain a collection of images to build and stages for each one of those images. A different inventory file can be specified using --inventory <file-path>.

Sonar comes with an inventory file to be able to build itself, and to run its unit tests. This simple.yaml is:

vars:
  # start a local registry with:
  # docker run -d -p 5000:5000 --restart=always --name registry registry:2
  registry: localhost:5000

images:
- name: sonar-test-runner

  vars:
    context: .

  # First stage builds a Docker image. The resulting image will be
  # pushed to the registry in the `output` section.
  stages:
  - name: build-sonar-tester-image
    task_type: docker_build

    dockerfile: docker/Dockerfile

    output:
    - registry: $(inputs.params.registry)/sonar-tester-image
      tag: $(inputs.params.version_id)

  # Second stage pushes the previously built image into a new
  # registry.
  - name: tag-image
    task_type: tag_image

    source:
      registry: $(stages['build-sonar-tester-image'].output[0].registry)
      tag: $(stages['build-sonar-tester-image'].output[0].tag)

    destination:
    - registry: $(inputs.params.registry)/sonar-tester-image
      tag: latest

To execute this inventory file, you can do:

$ python sonar.py --image sonar-test-runner --inventory inventories/simple.yaml

[build-sonar-tester-image/docker_build] stage-started build-sonar-tester-image: 1/2
[build-sonar-tester-image/docker_build] docker-image-push: localhost:5000/sonar-tester-image:8945563b-248e-4c03-bb0a-6cc15cff1a6e
[tag-image/tag_image] stage-started tag-image: 2/2
[tag-image/tag_image] docker-image-push: localhost:5000/sonar-tester-image:latest

At the end of this phase, you'll have a Docker image tagged as localhost:5000/sonar-tester-image:latest that you will be able to run with:

$ docker run localhost:5000/sonar-tester-image:latest
============================= test session starts ==============================
platform linux -- Python 3.9.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /src
collected 38 items

test/test_build.py ...                                                   [  7%]
test/test_context.py ......x.....                                        [ 39%]
test/test_sign_image.py ..                                               [ 44%]
test/test_sonar.py ........                                              [ 65%]
test/test_tag_image.py .                                                 [ 68%]
test/test_tags.py ...........                                            [ 97%]
test/test_template.py .                                                  [100%]

======================== 37 passed, 1 xfailed in 0.52s =========================

Legal

Sonar is released under the terms of the Apache2 license.

sonar's People

Contributors

chatton avatar irajdeep avatar julien-ben avatar lsierant avatar nammn avatar rodrigovalin avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.