Giter Club home page Giter Club logo

azure-pipelines-multiarch-docker's Introduction

azure-pipelines-multiarch-docker

Docker Stars Docker Pulls Build Status

This is a shim/template repo for an Azure DevOps pipeline to build multi-architecture images:

Pipeline Structure

At the Azure Pipelines level, this creates:

stages

  • One independent stage for each CPU architecture
  • A "wrap-up" stage that runs after all the others that builds and publishes the Docker manifest file

Why?

Because I needed a simple, re-usable example of how to build multi-architecture images (in, this case, Linux for several different CPU architectures) that I could both re-use and share with customers.

How?

Images are created atop a local base (in this case Ubuntu) with a corresponding qemu-user-static binary embedded, which allows most CI systems to build ARM images atop an amd64 CPU.

The sample src/Dockerfile only installs zsh into that image, but the intent is that you can build this up from there.

Internals

Most of the image generation logic (including embedding QEMU and building the final manifest that allows for automatic discovery of architecture-specific tags) lives inside the Makefile.

This is done because:

  • Having a Makefile allows for easy local testing
  • It also allows for easy movement between different CI systems
  • The actual architecture tagging (and mapping between different styles of architecture references) can be maintained inside the Makefile
  • Encapsulating that logic makes the CI YAML files considerably more readable

Projects Using This

Caveats

  • This does not cover multi-OS (Linux/Windows) images--the principles are the same, but that needs to split on the CI side to allow for different stages inside different VM agents.
  • This only uses Docker Hub (and requires DOCKER_USERNAME and DOCKER_PASSWORD to be set as private global variables for the pipeline--I recommend using linked variables at the organization level).
  • This does not use the built-in Docker actions in Azure Pipelines (because they do not yet support the experimental mode settings that are still required, as of June 2019, to build manifests).

azure-pipelines-multiarch-docker's People

Contributors

rcarmo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

azure-pipelines-multiarch-docker's Issues

Azure Pipeline - Makefile path issue

Hi,

Great job! I currently use one big bash script for creating multi-arch Docker images:
https://github.com/xirixiz/dsmr-reader-docker/

Currently I`m trying to adopt your way of working, which is working great localy, but I can't manage to get it work in an Azure Pipeline. Source code: https://github.com/xirixiz/dsmr-reader-docker/tree/new_build_process

Azure Pipeline log:

2020-02-03T12:33:02.3170325Z 2020-02-03 12:33:02 (3.54 MB/s) - qemu-aarch64-static.tar.gz saved [1675228/1675228]
2020-02-03T12:33:02.3171051Z 
2020-02-03T12:33:02.3682140Z cp: 'qemu-aarch64-static' and '../qemu/qemu-aarch64-static' are the same file
2020-02-03T12:33:02.3688323Z Makefile:40: recipe for target 'fetch-qemu-aarch64' failed
2020-02-03T12:33:02.3691297Z make[1]: Leaving directory '/home/vsts/work/1/s'
2020-02-03T12:33:02.3691986Z make[1]: *** [fetch-qemu-aarch64] Error 1
2020-02-03T12:33:02.3692539Z Makefile:33: recipe for target 'qemu' failed
2020-02-03T12:33:02.3692831Z make: *** [qemu] Error 2

It seems that there's a difficulty with paths. Perhaps you bumped into this before?

A bit more help

Hi @rcarmo

I really like the idea of this Makefile that simplifies the build of a multi architecture docker image, and I have the perfect candidate. sonos2mqtt should be perfectly capable to be runned on some arm device. The base image however node:lts-alpine is already multi architecture, would that make any difference in building this app for multiple architectures?

If I would understand the process i would be willing to create some more documentation about this process.

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.