Skip to content

Commit 39876c0

Browse files
committed
initial commit
Signed-off-by: kpango <kpango@vdaas.org>
0 parents  commit 39876c0

174 files changed

Lines changed: 50069 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/docker/action.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: "Docker Action"
2+
description: "Build or Merge Docker images using the repository's Makefile."
3+
inputs:
4+
operation:
5+
description: "The operation to perform (build or merge)"
6+
required: true
7+
target:
8+
description: "The Makefile target to run"
9+
required: true
10+
docker_user:
11+
description: "DockerHub username"
12+
required: true
13+
default: "kpango"
14+
docker_pass:
15+
description: "DockerHub password"
16+
required: true
17+
github_token:
18+
description: "GitHub Token"
19+
required: true
20+
docker_push:
21+
description: "Whether this is a push build"
22+
required: false
23+
default: "false"
24+
platform:
25+
description: "The platform to build"
26+
required: false
27+
suffix:
28+
description: "The suffix for the docker tag"
29+
required: false
30+
ghcr_user:
31+
description: "GHCR username"
32+
required: false
33+
default: ${{ github.repository_owner }}
34+
35+
runs:
36+
using: "composite"
37+
steps:
38+
- name: Set up QEMU
39+
if: inputs.operation == 'build'
40+
uses: docker/setup-qemu-action@v4
41+
with:
42+
image: tonistiigi/binfmt:master
43+
44+
- name: Login to DockerHub
45+
if: inputs.operation == 'merge' || inputs.docker_push == 'true'
46+
uses: docker/login-action@v4
47+
with:
48+
username: ${{ inputs.docker_user }}
49+
password: ${{ inputs.docker_pass }}
50+
51+
- name: Login to GitHub Container Registry
52+
if: inputs.operation == 'merge' || inputs.docker_push == 'true'
53+
uses: docker/login-action@v4
54+
with:
55+
registry: ghcr.io
56+
username: ${{ github.actor }}
57+
password: ${{ inputs.github_token }}
58+
59+
- name: Cache Docker layers
60+
if: inputs.operation == 'build'
61+
uses: actions/cache@v5
62+
with:
63+
path: ${{ github.workspace }}/.docker/buildcache
64+
key: ${{ runner.os }}-docker-buildx-${{ inputs.target }}-${{ inputs.platform }}
65+
restore-keys: |
66+
${{ runner.os }}-docker-buildx-${{ inputs.target }}-${{ inputs.platform }}
67+
${{ runner.os }}-docker-buildx-${{ inputs.target }}-
68+
${{ runner.os }}-docker-buildx-
69+
70+
- name: Create Buildx
71+
if: inputs.operation == 'build'
72+
shell: bash
73+
env:
74+
GITHUB_ACCESS_TOKEN: ${{ inputs.github_token }}
75+
DOCKER_BUILDER_PLATFORM: ${{ inputs.platform }}
76+
run: |
77+
make \
78+
DOCKER_BUILDER_PLATFORM="$DOCKER_BUILDER_PLATFORM" \
79+
GITHUB_ACCESS_TOKEN="$GITHUB_ACCESS_TOKEN" \
80+
create_buildx
81+
82+
- name: Run Makefile target
83+
shell: bash
84+
env:
85+
OPERATION: ${{ inputs.operation }}
86+
TARGET: ${{ inputs.target }}
87+
USER_DEFAULT: ${{ inputs.docker_user }}
88+
GHCR_USER: ${{ inputs.ghcr_user }}
89+
DOCKER_PUSH: ${{ inputs.docker_push }}
90+
GITHUB_ACCESS_TOKEN: ${{ inputs.github_token }}
91+
DOCKER_BUILDER_PLATFORM: ${{ inputs.platform }}
92+
DOCKER_ARCH_SUFFIX: ${{ inputs.suffix }}
93+
EVENT_NAME: ${{ github.event_name }}
94+
EVENT_PATH: ${{ github.event_path }}
95+
GITHUB_REF_VAR: ${{ github.ref }}
96+
DOCKER_BUILD_CACHE_DIR: ${{ github.workspace }}/.docker/buildcache
97+
run: |
98+
VERSION="nightly"
99+
100+
if [ "$EVENT_NAME" == "pull_request" ]; then
101+
PR_NUM=$(jq -r ".number" "$EVENT_PATH")
102+
VERSION="pr-$PR_NUM"
103+
elif [[ "$GITHUB_REF_VAR" == refs/tags/* ]]; then
104+
VERSION="${GITHUB_REF_VAR#refs/tags/}"
105+
fi
106+
107+
if [ "$OPERATION" == "build" ]; then
108+
make \
109+
DOCKER_BUILD_CACHE_DIR="$DOCKER_BUILD_CACHE_DIR" \
110+
DOCKER_PUSH="$DOCKER_PUSH" \
111+
USER="$USER_DEFAULT" \
112+
SYS_USER="$USER_DEFAULT" \
113+
USER_ID="1000" \
114+
GROUP_ID="1000" \
115+
GROUP_IDS="1000 98 972 987 994 996 998 1001 1002 1003 1004 1005" \
116+
GHCR_USER="$GHCR_USER" \
117+
VERSION="$VERSION" \
118+
GITHUB_ACCESS_TOKEN="$GITHUB_ACCESS_TOKEN" \
119+
DOCKER_BUILDER_PLATFORM="$DOCKER_BUILDER_PLATFORM" \
120+
DOCKER_ARCH_SUFFIX="$DOCKER_ARCH_SUFFIX" \
121+
"$TARGET"
122+
else
123+
make \
124+
USER="$USER_DEFAULT" \
125+
GHCR_USER="$GHCR_USER" \
126+
VERSION="$VERSION" \
127+
"$TARGET"
128+
fi

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: "Build docker images"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- "*.*.*"
8+
- "v*.*.*"
9+
- "*.*.*-*"
10+
- "v*.*.*-*"
11+
paths:
12+
- "dockers/**"
13+
- "Makefile"
14+
- ".github/workflows/**"
15+
pull_request:
16+
paths:
17+
- "dockers/**"
18+
- "Makefile"
19+
- ".github/workflows/**"
20+
workflow_dispatch:
21+
schedule:
22+
- cron: "0 0 * * *"
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
jobs:
27+
base:
28+
uses: ./.github/workflows/docker-reusable.yml
29+
with:
30+
build_target: build_base
31+
merge_target: merge_base
32+
secrets: inherit
33+
34+
images:
35+
needs: base
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
target:
40+
- name: dart
41+
- name: docker
42+
- name: env
43+
- name: gcloud
44+
- name: go
45+
- name: k8s
46+
- name: nim
47+
- name: rust
48+
uses: ./.github/workflows/docker-reusable.yml
49+
with:
50+
build_target: build_${{ matrix.target.name }}
51+
merge_target: merge_${{ matrix.target.name }}
52+
secrets: inherit
53+
54+
dev:
55+
needs: [base, images]
56+
if: |
57+
always() &&
58+
needs.base.result == 'success' &&
59+
!cancelled()
60+
uses: ./.github/workflows/docker-reusable.yml
61+
with:
62+
build_target: prod_build
63+
merge_target: merge_dev
64+
secrets: inherit
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "Reusable Docker Build & Merge"
2+
on:
3+
workflow_call:
4+
inputs:
5+
build_target:
6+
required: true
7+
type: string
8+
merge_target:
9+
required: true
10+
type: string
11+
12+
jobs:
13+
build:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
arch:
18+
- platform: linux/amd64
19+
runner: ubuntu-latest
20+
suffix: amd64
21+
- platform: linux/arm64/v8
22+
runner: ubuntu-24.04-arm
23+
suffix: arm64
24+
runs-on: ${{ matrix.arch.runner }}
25+
environment: copilot
26+
steps:
27+
- uses: actions/checkout@v6
28+
with:
29+
fetch-depth: 1
30+
31+
- name: Build and Push Docker Image
32+
uses: ./.github/actions/docker
33+
with:
34+
operation: build
35+
target: ${{ inputs.build_target }}
36+
docker_user: ${{ secrets.DOCKERHUB_USER || 'kpango' }}
37+
docker_pass: ${{ secrets.DOCKERHUB_PASS }}
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
docker_push: true
40+
platform: ${{ matrix.arch.platform }}
41+
suffix: ${{ matrix.arch.suffix }}
42+
43+
merge:
44+
needs: build
45+
runs-on: ubuntu-latest
46+
environment: copilot
47+
steps:
48+
- uses: actions/checkout@v6
49+
with:
50+
fetch-depth: 1
51+
52+
- name: Merge and Push Manifest
53+
uses: ./.github/actions/docker
54+
with:
55+
operation: merge
56+
target: ${{ inputs.merge_target }}
57+
docker_user: ${{ secrets.DOCKERHUB_USER || 'kpango' }}
58+
docker_pass: ${{ secrets.DOCKERHUB_PASS }}
59+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitinore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
nvim/site/*
2+
nvim/log/*
3+
nvim/plugin/*
4+
5+
# Binaries for programs and plugins
6+
*.exe
7+
*.exe~
8+
*.dll
9+
*.so
10+
*.dylib
11+
*.bin
12+
13+
# Test binary, built with `go test -c`
14+
*.test
15+
16+
# Output of the go coverage tool, specifically when used with LiteIDE
17+
*.out
18+
19+
.idea/
20+
21+
*.hdf5
22+
23+
.DS_Store
24+
.nvimlog
25+
26+
telepresence.log

.whitesource

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"generalSettings": {
3+
"shouldScanRepo": true
4+
},
5+
"checkRunSettings": {
6+
"vulnerableCheckRunConclusionLevel": "failure"
7+
}
8+
}

0 commit comments

Comments
 (0)