-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:pilksoc/CosmicKube
- Loading branch information
Showing
12 changed files
with
131 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: "Build CosmicKube cache server" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build-server: | ||
name: "Build Cache Server" | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '^1.22' | ||
|
||
- name: Build | ||
run: | | ||
cd kube_cache | ||
go build && strip kube_cache | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: cache_server | ||
path: kube_cache/kube_cache | ||
|
||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# this will push the docker images to the github container registry | ||
# you will need to give actions permission to push there first | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: kube_cache/cache.Dockerfile | ||
push: true | ||
tags: | | ||
ghcr.io/pilksoc/kubecache:latest | ||
ghcr.io/pilksoc/kubecache:dev-${{ github.run_number }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ pub mod space; | |
pub mod kube; | ||
pub mod player; | ||
pub mod llm; | ||
pub mod local_grid; | ||
|
||
type Coordinate = [u64; 2]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use crate::Coordinate; | ||
use crate::grid::Grid; | ||
use crate::space::Space; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct LocalGrid { | ||
spaces: Vec<Space>, | ||
} | ||
impl LocalGrid { | ||
pub fn from_grid_and_coord(grid: &Grid, coordinate: Coordinate, local_size: u64) -> LocalGrid { | ||
let mut spaces: Vec<Space> = Vec::new(); | ||
for space in grid.get_neighbours_n_away(coordinate, local_size) { | ||
spaces.push(space.clone()) | ||
} | ||
LocalGrid { spaces } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM debian:12.5-slim | ||
|
||
RUN apt update && apt install ca-certificates -y && apt upgrade -y | ||
WORKDIR /usr/local/kube_cache | ||
COPY kube_cache/kube_cache /usr/local/bin/kube_cache | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["kube_cache"] |