Coder Social home page Coder Social logo

docker-images's Introduction

Docker image builder

Builds your Docker images automatically, like magic. Good for handling common base images for all your projects, apps, whatever.

This repository builds images to IOXIO® GitHub Packages or ghcr.io/ioxiocom/

How do you use this then?

Well, we got 3 things you need to worry about:

  1. General configuration in settings.py: Basically you need to set up your Docker hub username prefixed by the ghcr.io since we are using GitHub container registry so as to prefix all built images with the right name
  2. Images and versions: First level of subdirectories in this repo is "images", as in the repository names (username/<repository>) for Docker hub. The subdirectories in that defines the "versions" - basically default tags for things to be built for that repository.
  3. Additional tags: In image/version/config.yaml you can define additional tags for the built image, like latest, or whatever aliases you may want for it.

Afterwards you can either set this up on your own build pipelines with the commands:

poetry install
poetry run build_multiplatform
poetry run upload
poetry run scan

If you have images other images depend on, check out the settings.PRIORITY_BUILDS option. Each list within it gets assigned a priority and can be built in parallel with --parallel argument, the rest of the images will then get built after everything in the PRIORITY_BUILDS.

# Simple priority to a couple of images
PRIORITY_BUILDS = [
   "ubuntu-base/20.04",
   "ubuntu-base/22.04",
]
# Tiered priorities of things that depend on earlier priorities
PRIORITY_BUILDS = [
  [
      "ubuntu-base/20.04",
      "ubuntu-base/22.04",
  ],
  [
      "python-base/ubuntu20.04-python3.9",
      "python-base/ubuntu22.04-python3.10",
  ]
]

But what does it require?

You will need:

You could also just use the preconfigured GitHub workflows. If you do you'll just need to add a DOCKERHUB_TOKEN secret ("token" is a personal access token) that will be used to log into your account for upload. This needs to be for the Docker hub user configured in settings.py.

The scan command uses trivy which you will need installed on your system first.

Multiplatform support

There are several technical restrictions when building images for multiple platforms with buildx, such as that buildx can't find an image in local docker environment (see notes in output section of the docs). But it's possible to push base images right away to a docker registry and then explicitly define this registry in FROM statements.

That's why there are 2 options to build images:

  • poetry run build builds all images for the current platform only with docker build under the hood. It's suitable for local development of the images
  • poetry run build_multiplatform builds all images using docker buildx build for linux/amd64 and linux/arm64. It requires extra setup (check pipeline code) and is not recommended for local development

Contributions

If you plan on contributing to the code ensure you use pre-commit to guarantee the code style stays uniform etc.

Also, please open an issue first to discuss the idea before sending a PR so that you know if it would be wanted or needs re-thinking or if you should just make a fork for yourself.

If I use this it means you own my things, right?

No. You are responsible for and own your own things. This code is licensed under the BSD 3-clause license.

docker-images's People

Contributors

actions-user avatar fbjorn avatar joakimnordling avatar lietu avatar omarudolley avatar thehelias avatar

Stargazers

 avatar

Watchers

 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.