CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
78 lines
2.6 KiB
TypeScript
78 lines
2.6 KiB
TypeScript
#!/usr/bin/env bun
|
|
|
|
import { $ } from "bun"
|
|
import path from "path"
|
|
import { fileURLToPath } from "url"
|
|
|
|
const rootDir = fileURLToPath(new URL("../../..", import.meta.url))
|
|
process.chdir(rootDir)
|
|
|
|
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 root = path.join(rootDir, "package.json")
|
|
const pkg = await Bun.file(root).json()
|
|
const manager = pkg.packageManager ?? ""
|
|
const bun = manager.startsWith("bun@") ? manager.slice(4) : ""
|
|
if (!bun) throw new Error("packageManager must be bun@<version>")
|
|
|
|
const images = ["base", "bun-node", "rust", "tauri-linux", "publish"]
|
|
|
|
const setup = async () => {
|
|
if (!push) return
|
|
const list = await $`docker buildx ls`.text()
|
|
if (list.includes("opencode")) {
|
|
await $`docker buildx use opencode`
|
|
return
|
|
}
|
|
await $`docker buildx create --name opencode --use`
|
|
}
|
|
|
|
await setup()
|
|
|
|
const platform = "linux/amd64,linux/arm64"
|
|
|
|
for (const name of images) {
|
|
const image = `${reg}/build/${name}:${tag}`
|
|
const file = `packages/containers/${name}/Dockerfile`
|
|
if (name === "base") {
|
|
if (push) {
|
|
console.log(`docker buildx build --platform ${platform} -f ${file} -t ${image} --push .`)
|
|
await $`docker buildx build --platform ${platform} -f ${file} -t ${image} --push .`
|
|
}
|
|
if (!push) {
|
|
console.log(`docker build -f ${file} -t ${image} .`)
|
|
await $`docker build -f ${file} -t ${image} .`
|
|
}
|
|
}
|
|
if (name === "bun-node") {
|
|
if (push) {
|
|
console.log(
|
|
`docker buildx build --platform ${platform} -f ${file} -t ${image} --build-arg REGISTRY=${reg} --build-arg BUN_VERSION=${bun} --push .`,
|
|
)
|
|
await $`docker buildx build --platform ${platform} -f ${file} -t ${image} --build-arg REGISTRY=${reg} --build-arg BUN_VERSION=${bun} --push .`
|
|
}
|
|
if (!push) {
|
|
console.log(`docker build -f ${file} -t ${image} --build-arg REGISTRY=${reg} --build-arg BUN_VERSION=${bun} .`)
|
|
await $`docker build -f ${file} -t ${image} --build-arg REGISTRY=${reg} --build-arg BUN_VERSION=${bun} .`
|
|
}
|
|
}
|
|
if (name !== "base" && name !== "bun-node") {
|
|
if (push) {
|
|
console.log(
|
|
`docker buildx build --platform ${platform} -f ${file} -t ${image} --build-arg REGISTRY=${reg} --push .`,
|
|
)
|
|
await $`docker buildx build --platform ${platform} -f ${file} -t ${image} --build-arg REGISTRY=${reg} --push .`
|
|
}
|
|
if (!push) {
|
|
console.log(`docker build -f ${file} -t ${image} --build-arg REGISTRY=${reg} .`)
|
|
await $`docker build -f ${file} -t ${image} --build-arg REGISTRY=${reg} .`
|
|
}
|
|
}
|
|
|
|
if (push) {
|
|
console.log(`pushed ${image}`)
|
|
}
|
|
}
|