Giter Club home page Giter Club logo

containers_by_bazel's Introduction

Build OCI images using Bazel. Benefits include reproducibility, rebuild speed, composability.

To use as a base

Choose a commit and add the below to your WORKSPACE file:

git_repository(
  name = "containers_by_bazel",
  remote = "https://github.com/guymers/containers_by_bazel.git",
  commit = "<commit-id>",
)

load("@containers_by_bazel//scripts:repositories.bzl", "dependency_repositories")
dependency_repositories()

Using containers

Create a BUILD file and use the name of the git repository prefixed with a @.

container_image(
  name = "jenkins_with_plugins",
  base = "@containers_by_bazel//jenkins",
  ...
)

Custom Debian dependencies

Create a BUILD file with the contents:

load("@containers_by_bazel//scripts/debian:dependencies.bzl", "dependencies")

dependencies(
  name = "",
  dependencies = glob(["dependencies/*"]),
  target_prefix = "@containers_by_bazel"
)

Where the dependencies folder contains files in the format of the ones in scripts/debian/dependencies/

Then you'll need to pretty much copy scripts/update_dependencies.sh

To use as is

To create containers

You can use the ./build_container script. It ensures that you cannot override the same tag with a different image.

bazel build //scripts/versions
source ./bazel-bin/scripts/versions/versions.sh
./scripts/build_container.sh //grafana grafana ${GRAFANA_VERSION}
./scripts/build_container.sh //java:zulu zulu ${ZULU_VERSION}
./scripts/build_container.sh //jenkins jenkins ${JENKINS_VERSION}
./scripts/build_container.sh //jenkins:agent jenkins-agent ${JENKINS_SWARM_VERSION}
./scripts/build_container.sh //kafka kafka ${KAFKA_VERSION}
./scripts/build_container.sh //proxy/nexus nexus ${NEXUS_VERSION}
./scripts/build_container.sh //nginx nginx ${NGINX_VERSION}
./scripts/build_container.sh //nodejs nodejs ${NODEJS_VERSION}
./scripts/build_container.sh //php php ${PHP_VERSION}
./scripts/build_container.sh //prometheus prometheus ${PROMETHEUS_VERSION}
./scripts/build_container.sh //proxy/polipo polipo ${POLIPO_VERSION}
./scripts/build_container.sh //postgresql postgresql ${POSTGRESQL_VERSION}
./scripts/build_container.sh //postgresql:postgis postgis ${POSTGRESQL_VERSION}-${POSTGIS_VERSION}
./scripts/build_container.sh //redis redis ${REDIS_VERSION}
./scripts/build_container.sh //sbt sbt ${SBT_VERSION}
./scripts/build_container.sh //zookeeper zookeeper ${ZOOKEEPER_VERSION}

To test:

bazel test //test/...

To update dependencies

Create the docker containers to pull dependency versions from:

DOCKER_NO_CACHE=true ./scripts/docker/create.sh

Update dependencies in files:

./scripts/update_dependencies.sh

Find packages that have been upgraded:

./scripts/debian/find_upgrades.sh

Create sbt ivy cache

bazel build //sbt/ivy_cache
// bazel-genfiles/sbt/ivy_cache/ivy_cache.tar

Users

911 nexus
912 jenkins
913 tomcat
918 kafka
919 zookeeper
921 prometheus
922 grafana
930 nginx
931 redis
941 postgres
981 polipo

containers_by_bazel's People

Contributors

guymers avatar

Watchers

 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.