Template
1
0
mirror of https://github.com/aminya/setup-cpp synced 2024-11-30 21:22:30 +08:00
setup-cpp/dev/docker/ci/docker-ci.mjs
2024-03-24 00:20:20 -07:00

22 lines
871 B
JavaScript

import { readFile, writeFile } from "fs/promises"
async function main() {
const names = ["ubuntu-llvm", "arch-llvm", "fedora-llvm", "ubuntu-mingw", "arch-mingw", "fedora-mingw"]
await Promise.all(
names.map(async (name) => {
const dockerFileContent = await readFile(`./dev/docker/setup-cpp/setup-cpp-${name}.dockerfile`, "utf-8")
const modifiedDockerFile = dockerFileContent
// load the externally built setup-cpp
.replace(/FROM (.*)/g, `FROM $1\n\nCOPY "./dist/legacy" "/usr/lib/setup-cpp/"`)
.replace("setup-cpp ", "node /usr/lib/setup-cpp/setup-cpp.js ")
// remove the npm install line
.replace(/# install setup-cpp\n\s*npm install -g setup-cpp.*/, "")
// write the new file in dev/docker/ci
await writeFile(`./dev/docker/ci/${name}.dockerfile`, modifiedDockerFile)
}),
)
}
await main()