Skip to content

Commit

Permalink
Use flocken for multiarch images
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRx committed Apr 20, 2024
1 parent b57e37d commit fcb0d7c
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 26 deletions.
39 changes: 14 additions & 25 deletions .github/workflows/push-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,32 @@ name: Push Image
on:
push:
# Sequence of patterns matched against refs/tags
branches:
- 'fix-multiarch-build'
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
x86_64:
multiarch:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: cachix/install-nix-action@v21
- name: Build
run: |
nix build .#container
skopeo login --username "${{ github.actor }}" --password "${{ secrets.GITHUB_TOKEN }}" ghcr.io
skopeo copy docker-archive://$(readlink -f ./result) docker://ghcr.io/chrisrx/quake-kube:latest
aarch64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- run: sudo apt-get install -y qemu-user-static
- uses: cachix/install-nix-action@v21
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: DeterminateSystems/nix-installer-action@v9
with:
extra_nix_config: |
system = aarch64-linux
- name: Build
run: |
nix build .#container
skopeo login --username "${{ github.actor }}" --password "${{ secrets.GITHUB_TOKEN }}" ghcr.io
skopeo copy docker-archive://$(readlink -f ./result) docker://ghcr.io/chrisrx/quake-kube:latest
extra-conf: |
extra-platforms = aarch64-linux
- uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix run --impure .#dockerManifest
env:
VERSION: "latest"
GITHUB_TOKEN: ${{ github.token }}
75 changes: 75 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
inputs.gomod2nix.url = "github:nix-community/gomod2nix";
inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils";
inputs.flocken.url = "github:mirkolenz/flocken/v2";
inputs.flocken.inputs.nixpkgs.follows = "nixpkgs";

outputs = { self, nixpkgs, flake-utils, gomod2nix }:
outputs = { self, nixpkgs, flake-utils, gomod2nix, flocken }:
(flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ]
(system:
let
Expand Down Expand Up @@ -98,6 +100,15 @@
];
config.Cmd = [ "${packages.default}/bin/q3" ];
};
legacyPackages.dockerManifest = flocken.legacyPackages.${system}.mkDockerManifest {
github = {
enable = true;
repo = "chrisrx/quake-kube";
token = builtins.getEnv "GITHUB_TOKEN";
};
version = builtins.getEnv "VERSION";
images = with self.packages; [ x86_64-linux.container aarch64-linux.container ];
};

devShells.default =
pkgs.mkShell {
Expand Down
8 changes: 8 additions & 0 deletions internal/quake/server/gamefiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import (
"log"
"os"
"path/filepath"
"strings"

contentutil "github.com/ChrisRx/quake-kube/internal/quake/content/util"
)

//go:embed EULA.txt
Expand Down Expand Up @@ -44,6 +47,11 @@ func ExtractGameFiles(dir string) error {
if err := os.WriteFile(path, data, 0644); err != nil {
return err
}
if strings.HasPrefix(hdr.Name, "linuxq3ademo") || strings.HasPrefix(hdr.Name, "linuxq3apoint") {
if err := contentutil.ExtractGzip(path, dir); err != nil {
return err
}
}
}
}
return nil
Expand Down
Binary file modified internal/quake/server/gamefiles.tar
Binary file not shown.

0 comments on commit fcb0d7c

Please sign in to comment.