aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-09-26 17:19:21 +0200
committerAlex Auvolat <alex@adnab.me>2022-09-26 19:09:55 +0200
commitd104ae871170e5d1dac644921815bcce8496f23c (patch)
tree59ec54a001595893af56f5ed42b7eabd0b53086b
parentea7a571d883fcf40822ccd265e4975ac607b234a (diff)
downloadgarage-multi-arch-container.tar.gz
garage-multi-arch-container.zip
Add step to generate multi-arch Docker container in CImulti-arch-container
-rw-r--r--.drone.yml13
-rw-r--r--nix/manifest-tool.nix23
-rw-r--r--shell.nix30
3 files changed, 65 insertions, 1 deletions
diff --git a/.drone.yml b/.drone.yml
index 277bfbc2..f5ac6179 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -245,6 +245,17 @@ node:
nix-daemon: 1
steps:
+ - name: multiarch-docker
+ image: nixpkgs/nix:nixos-22.05
+ environment:
+ DOCKER_AUTH:
+ from_secret: docker_auth
+ HOME: "/root"
+ commands:
+ - mkdir -p /root/.docker
+ - echo $DOCKER_AUTH > /root/.docker/config.json
+ - export CONTAINER_TAG=${DRONE_TAG:-$DRONE_COMMIT}
+ - nix-shell --attr release --run "multiarch_docker"
- name: refresh-index
image: nixpkgs/nix:nixos-22.05
environment:
@@ -269,6 +280,6 @@ trigger:
---
kind: signature
-hmac: 362639b4c9541ad9bd06ff7f72b5235b2b0216bcb16eececd25285b6fe94ba6f
+hmac: 103a04785c98f5376a63ce22865c2576963019bbc4d828f200d2a470a3c821ea
...
diff --git a/nix/manifest-tool.nix b/nix/manifest-tool.nix
new file mode 100644
index 00000000..182ccc0e
--- /dev/null
+++ b/nix/manifest-tool.nix
@@ -0,0 +1,23 @@
+pkgs:
+pkgs.buildGoModule rec {
+ pname = "manifest-tool";
+ version = "2.0.5";
+
+ src = pkgs.fetchFromGitHub {
+ owner = "estesp";
+ repo = "manifest-tool";
+ rev = "v${version}";
+ sha256 = "hjCGKnE0yrlnF/VIzOwcDzmQX3Wft+21KCny/opqdLg=";
+ } + "/v2";
+
+ vendorSha256 = null;
+
+ checkPhase = "true";
+
+ meta = with pkgs.lib; {
+ description = "Command line tool to create and query container image manifest list/indexes";
+ homepage = "https://github.com/estesp/manifest-tool";
+ license = licenses.asl20;
+ platforms = platforms.linux;
+ };
+}
diff --git a/shell.nix b/shell.nix
index ea5d6356..e82bce78 100644
--- a/shell.nix
+++ b/shell.nix
@@ -10,6 +10,7 @@ let
overlays = [ cargo2nixOverlay ];
};
kaniko = (import ./nix/kaniko.nix) pkgs;
+ manifest-tool = (import ./nix/manifest-tool.nix) pkgs;
winscp = (import ./nix/winscp.nix) pkgs;
in
@@ -84,6 +85,34 @@ function to_docker {
--verbosity=debug
}
+function multiarch_docker {
+ manifest-tool push from-spec <(cat <<EOF
+image: dxflrs/garage:''${CONTAINER_TAG}
+manifests:
+ -
+ image: dxflrs/arm64_garage:''${CONTAINER_TAG}
+ platform:
+ architecture: arm64
+ os: linux
+ -
+ image: dxflrs/amd64_garage:''${CONTAINER_TAG}
+ platform:
+ architecture: amd64
+ os: linux
+ -
+ image: dxflrs/386_garage:''${CONTAINER_TAG}
+ platform:
+ architecture: 386
+ os: linux
+ -
+ image: dxflrs/arm_garage:''${CONTAINER_TAG}
+ platform:
+ architecture: arm
+ os: linux
+EOF
+ )
+}
+
function refresh_index {
aws \
--endpoint-url https://garage.deuxfleurs.fr \
@@ -113,6 +142,7 @@ function refresh_index {
nativeBuildInputs = [
pkgs.awscli2
kaniko
+ manifest-tool
];
};
}