Skip to content

Commit 9ba699e

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

173 files changed

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

.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: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
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+
build_base:
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
arch:
32+
- platform: linux/amd64
33+
runner: ubuntu-latest
34+
suffix: amd64
35+
- platform: linux/arm64/v8
36+
runner: ubuntu-24.04-arm
37+
suffix: arm64
38+
runs-on: ${{ matrix.arch.runner }}
39+
environment: copilot
40+
steps:
41+
- uses: actions/checkout@v6
42+
with:
43+
fetch-depth: 1
44+
45+
- name: Build and Push Docker Image
46+
uses: ./.github/actions/docker-build
47+
with:
48+
target: build_base
49+
docker_user: ${{ secrets.DOCKERHUB_USER || 'kpango' }}
50+
docker_pass: ${{ secrets.DOCKERHUB_PASS }}
51+
github_token: ${{ secrets.GITHUB_TOKEN }}
52+
docker_push: true
53+
platform: ${{ matrix.arch.platform }}
54+
suffix: ${{ matrix.arch.suffix }}
55+
56+
merge_base:
57+
needs: build_base
58+
runs-on: ubuntu-slim
59+
environment: copilot
60+
steps:
61+
- uses: actions/checkout@v6
62+
with:
63+
fetch-depth: 1
64+
65+
- name: Merge and Push Manifest
66+
uses: ./.github/actions/docker-build
67+
with:
68+
target: merge_base
69+
docker_user: ${{ secrets.DOCKERHUB_USER || 'kpango' }}
70+
docker_pass: ${{ secrets.DOCKERHUB_PASS }}
71+
github_token: ${{ secrets.GITHUB_TOKEN }}
72+
docker_push: true
73+
74+
build:
75+
needs: merge_base
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
arch:
80+
- platform: linux/amd64
81+
runner: ubuntu-latest
82+
suffix: amd64
83+
- platform: linux/arm64/v8
84+
runner: ubuntu-24.04-arm
85+
suffix: arm64
86+
image_target:
87+
- image: dart
88+
target: build_dart
89+
- image: docker
90+
target: build_docker
91+
- image: env
92+
target: build_env
93+
- image: gcloud
94+
target: build_gcloud
95+
- image: go
96+
target: build_go
97+
- image: kube
98+
target: build_k8s
99+
- image: nim
100+
target: build_nim
101+
- image: rust
102+
target: build_rust
103+
runs-on: ${{ matrix.arch.runner }}
104+
environment: copilot
105+
continue-on-error: true
106+
steps:
107+
- uses: actions/checkout@v6
108+
with:
109+
fetch-depth: 1
110+
111+
- name: Build and Push Docker Image
112+
uses: ./.github/actions/docker-build
113+
with:
114+
target: ${{ matrix.image_target.target }}
115+
docker_user: ${{ secrets.DOCKERHUB_USER || 'kpango' }}
116+
docker_pass: ${{ secrets.DOCKERHUB_PASS }}
117+
github_token: ${{ secrets.GITHUB_TOKEN }}
118+
docker_push: true
119+
platform: ${{ matrix.arch.platform }}
120+
suffix: ${{ matrix.arch.suffix }}
121+
122+
merge:
123+
needs: build
124+
runs-on: ubuntu-slim
125+
environment: copilot
126+
continue-on-error: true
127+
strategy:
128+
fail-fast: false
129+
matrix:
130+
image_target:
131+
- image: dart
132+
target: merge_dart
133+
- image: docker
134+
target: merge_docker
135+
- image: env
136+
target: merge_env
137+
- image: gcloud
138+
target: merge_gcloud
139+
- image: go
140+
target: merge_go
141+
- image: kube
142+
target: merge_k8s
143+
- image: nim
144+
target: merge_nim
145+
- image: rust
146+
target: merge_rust
147+
steps:
148+
- uses: actions/checkout@v6
149+
with:
150+
fetch-depth: 1
151+
152+
- name: Merge and Push Manifest
153+
uses: ./.github/actions/docker-build
154+
with:
155+
target: ${{ matrix.image_target.target }}
156+
docker_user: ${{ secrets.DOCKERHUB_USER || 'kpango' }}
157+
docker_pass: ${{ secrets.DOCKERHUB_PASS }}
158+
github_token: ${{ secrets.GITHUB_TOKEN }}
159+
docker_push: true
160+
161+
build_dev:
162+
needs: merge
163+
strategy:
164+
fail-fast: false
165+
matrix:
166+
arch:
167+
- platform: linux/amd64
168+
runner: ubuntu-latest
169+
suffix: amd64
170+
- platform: linux/arm64/v8
171+
runner: ubuntu-24.04-arm
172+
suffix: arm64
173+
runs-on: ${{ matrix.arch.runner }}
174+
environment: copilot
175+
steps:
176+
- uses: actions/checkout@v6
177+
with:
178+
fetch-depth: 1
179+
180+
- name: Build and Push Docker Image
181+
uses: ./.github/actions/docker-build
182+
with:
183+
target: prod_build
184+
docker_user: ${{ secrets.DOCKERHUB_USER || 'kpango' }}
185+
docker_pass: ${{ secrets.DOCKERHUB_PASS }}
186+
github_token: ${{ secrets.GITHUB_TOKEN }}
187+
docker_push: true
188+
platform: ${{ matrix.arch.platform }}
189+
suffix: ${{ matrix.arch.suffix }}
190+
191+
merge_dev:
192+
needs: build_dev
193+
runs-on: ubuntu-slim
194+
environment: copilot
195+
steps:
196+
- uses: actions/checkout@v6
197+
with:
198+
fetch-depth: 1
199+
200+
- name: Merge and Push Manifest
201+
uses: ./.github/actions/docker-build
202+
with:
203+
target: merge_dev
204+
docker_user: ${{ secrets.DOCKERHUB_USER || 'kpango' }}
205+
docker_pass: ${{ secrets.DOCKERHUB_PASS }}
206+
github_token: ${{ secrets.GITHUB_TOKEN }}
207+
docker_push: true

.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)