From c686f6cfd09144d1af26d715261ad6a60caef320 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Fri, 13 Dec 2024 15:35:51 -0500 Subject: [PATCH] xdbg docker build --- .github/workflows/release-xdbg.yml | 37 +++++++++++++++++++++++++ flake.lock | 38 +++++++++++++------------- flake.nix | 3 +- nix/mls_validation_service/default.nix | 6 ++-- nix/xdbg/default.nix | 14 ++++------ nix/xdbg/result | 1 - 6 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/release-xdbg.yml delete mode 120000 nix/xdbg/result diff --git a/.github/workflows/release-xdbg.yml b/.github/workflows/release-xdbg.yml new file mode 100644 index 000000000..3e034d699 --- /dev/null +++ b/.github/workflows/release-xdbg.yml @@ -0,0 +1,37 @@ +name: Build and Push xdbgDocker +on: + push: + branches: + - main + workflow_dispatch: +jobs: + build-and-push: + runs-on: ubuntu-latest + strategy: + matrix: + platform: [aarch64-darwin, x86_64-linux, aarch64-linux, x86_64-darwin] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v20 + with: + nix_path: nixpkgs=channel:nixos-unstable + - uses: cachix/cachix-action@v14 + with: + name: xmtp + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Build xdbgDocker + run: | + nix build .#packages.${{ matrix.platform }}.xdbgDocker + - name: Log in to GitHub Container Registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Tag Docker image + run: | + IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:xdbg-${{ matrix.platform }} + nix path-info .#packages.${{ matrix.platform }}.xdbgDocker | xargs -I {} docker load < {}/docker-image.tar.gz + docker tag $(docker images --filter "label=org.opencontainers.image.title=xdbg" -q):latest $IMAGE_NAME + - name: Push Docker image to GHCR + run: | + IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:xdbg-${{ matrix.platform }} + docker push $IMAGE_NAME diff --git a/flake.lock b/flake.lock index 6b7d6f829..fda613fd1 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1731974733, - "narHash": "sha256-enYSSZVVl15FI5p+0Y5/Ckf5DZAvXe6fBrHxyhA/njc=", + "lastModified": 1733286231, + "narHash": "sha256-mlIDSv1/jqWnH8JTiOV7GMUNPCXL25+6jmD+7hdxx5o=", "owner": "ipetkov", "repo": "crane", - "rev": "3cb338ce81076ce5e461cf77f7824476addb0e1c", + "rev": "af1556ecda8bcf305820f68ec2f9d77b41d9cc80", "type": "github" }, "original": { @@ -23,11 +23,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1732343620, - "narHash": "sha256-IuOzr1HjFK8RxeDITfe1LQKgbUjgqlgeGc8jf9tKAuY=", + "lastModified": 1733380458, + "narHash": "sha256-H+IQB6cJ7ji/YD537pcSUWlwGGJ49RoYylBonyNW9hk=", "owner": "nix-community", "repo": "fenix", - "rev": "cb6515f398908e1c74dea085e72b3e3a0a81c6e2", + "rev": "08c9e4e29865b60cb81189f8e4de0dccaf297865", "type": "github" }, "original": { @@ -41,11 +41,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1730504689, - "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "506278e768c2a08bec68eb62932193e341f55c90", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", "type": "github" }, "original": { @@ -56,11 +56,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1732014248, - "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", + "lastModified": 1733212471, + "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", + "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776", "type": "github" }, "original": { @@ -72,14 +72,14 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1730504152, - "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", + "lastModified": 1733096140, + "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" } }, "root": { @@ -94,11 +94,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1732050317, - "narHash": "sha256-G5LUEOC4kvB/Xbkglv0Noi04HnCfryur7dVjzlHkgpI=", + "lastModified": 1733330394, + "narHash": "sha256-1jwtAQYtErSsfkEQFvZJ9wJBrLGltzlvZKZzPXhpfpE=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "c0bbbb3e5d7d1d1d60308c8270bfd5b250032bb4", + "rev": "f499faf72bcd2abbfbf3d7171e5191100547a3df", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8aa036166..d3d0a2c36 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,7 @@ fenixPkgs = inputs'.fenix.packages; rust-toolchain = fenixPkgs.fromToolchainFile { file = ./rust-toolchain; - sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk="; + sha256 = "sha256-s1RPtyvDGJaX/BisLT+ifVfuhDT1nZkZ1NcK8sbwELM="; }; pkgConfig = { @@ -84,6 +84,7 @@ libFileSetForWorkspace fileSetForCrate; }; + xdbg = import ./nix/xdbg { inherit pkgs craneLib filesets; }; diff --git a/nix/mls_validation_service/default.nix b/nix/mls_validation_service/default.nix index 87d5dac13..6579ba2c3 100644 --- a/nix/mls_validation_service/default.nix +++ b/nix/mls_validation_service/default.nix @@ -10,12 +10,12 @@ let rustTarget = "x86_64-unknown-linux-musl"; }; - dockerImage = pkgs.dockerTools.streamLayeredImage { - name = "xmtp/mls_validation_service"; + dockerImage = pkgs.dockerTools.buildImage { + name = "xmtp/mls-validation-service"; tag = "latest"; contents = [ muslService.bin ]; config = { - Cmd = [ "${muslService.bin}/bin/mls_validation_service" ]; + Cmd = [ "${muslService.bin}/bin/mls-validation-service" ]; }; }; in diff --git a/nix/xdbg/default.nix b/nix/xdbg/default.nix index d34947138..07ed11cd2 100644 --- a/nix/xdbg/default.nix +++ b/nix/xdbg/default.nix @@ -1,19 +1,14 @@ -{ - pkgs, - craneLib, - filesets, -}: +{ pkgs, craneLib, filesets }: let xdbg = pkgs.callPackage ./crate.nix { inherit craneLib filesets; }; muslXDbg = pkgs.pkgsCross.musl64.callPackage ./crate.nix { - inherit craneLib filesets; - rustTarget = "x86_64-unknown-linux-musl"; + inherit craneLib filesets; rustTarget = "x86_64-unknown-linux-musl"; }; - dockerImage = pkgs.dockerTools.streamLayeredImage { + dockerImage = pkgs.dockerTools.buildImage { name = "xmtp/xdbg"; tag = "latest"; - contents = [ muslXDbg.bin ]; + copyToRoot = [ muslXDbg.bin ]; config = { Cmd = [ "${muslXDbg.bin}/bin/xdbg" ]; }; @@ -25,3 +20,4 @@ in inherit muslXDbg; inherit dockerImage; } + diff --git a/nix/xdbg/result b/nix/xdbg/result deleted file mode 120000 index ff9d143e6..000000000 --- a/nix/xdbg/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/rwhlnfgql23bkim917gl5llvnf966dwb-xdbg-0.1.0 \ No newline at end of file