mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
ci: add container build workflow
Add prebuilt build images and a publish workflow to speed CI by reusing heavy dependencies.
This commit is contained in:
25
packages/containers/script/build.ts
Normal file
25
packages/containers/script/build.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { $ } from "bun"
|
||||
|
||||
const dir = new URL("..", import.meta.url).pathname
|
||||
process.chdir(dir)
|
||||
|
||||
const reg = process.env.REGISTRY ?? "ghcr.io/anomalyco"
|
||||
const tag = process.env.TAG ?? "24.04"
|
||||
const push = process.argv.includes("--push") || process.env.PUSH === "1"
|
||||
|
||||
const images = ["base", "bun-node", "rust", "tauri-linux", "publish"]
|
||||
|
||||
for (const name of images) {
|
||||
const image = `${reg}/build/${name}:${tag}`
|
||||
const file = `packages/containers/${name}/Dockerfile`
|
||||
const arg = name === "base" ? "" : `--build-arg REGISTRY=${reg}`
|
||||
const cmd = `docker build -f ${file} -t ${image} ${arg} .`
|
||||
console.log(cmd)
|
||||
await $`${cmd}`
|
||||
|
||||
if (push) {
|
||||
await $`docker push ${image}`
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user