2021-10-28 13:29:00 +02:00
|
|
|
const fs = require("fs")
|
|
|
|
const { execSync } = require("child_process")
|
|
|
|
const path = require("path")
|
|
|
|
|
|
|
|
const IMAGES = {
|
|
|
|
worker: "budibase/worker",
|
|
|
|
apps: "budibase/apps",
|
2022-02-01 11:02:37 +01:00
|
|
|
proxy: "budibase/proxy",
|
2021-10-28 13:29:00 +02:00
|
|
|
minio: "minio/minio",
|
|
|
|
couch: "ibmcom/couchdb3",
|
|
|
|
curl: "curlimages/curl",
|
|
|
|
redis: "redis",
|
|
|
|
watchtower: "containrrr/watchtower"
|
|
|
|
}
|
|
|
|
|
|
|
|
const FILES = {
|
|
|
|
COMPOSE: "docker-compose.yaml",
|
2022-01-30 21:11:59 +01:00
|
|
|
NGINX: "nginx.conf"
|
2021-10-28 13:29:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const OUTPUT_DIR = path.join(__dirname, "../", "bb-airgapped")
|
|
|
|
|
|
|
|
function copyFile(file) {
|
|
|
|
fs.copyFileSync(
|
|
|
|
path.join(__dirname, "../", "../", file),
|
|
|
|
path.join(OUTPUT_DIR, file)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
// create output dir
|
|
|
|
console.log(`Creating ${OUTPUT_DIR} for build..`)
|
|
|
|
fs.rmdirSync(OUTPUT_DIR, { recursive: true })
|
|
|
|
fs.mkdirSync(OUTPUT_DIR)
|
|
|
|
|
|
|
|
// package images into tar files
|
|
|
|
for (let image in IMAGES) {
|
|
|
|
console.log(`Creating tar for ${image}..`)
|
|
|
|
execSync(`docker save ${IMAGES[image]} -o ${OUTPUT_DIR}/${image}.tar`)
|
|
|
|
}
|
|
|
|
|
|
|
|
// copy config files
|
|
|
|
copyFile(FILES.COMPOSE)
|
|
|
|
copyFile(FILES.ENVOY)
|
2021-10-28 18:22:47 +02:00
|
|
|
copyFile(FILES.PROPERTIES)
|
2021-10-28 13:29:00 +02:00
|
|
|
|
|
|
|
// compress
|
|
|
|
execSync(`tar -czf bb-airgapped.tar.gz hosting/scripts/bb-airgapped`)
|
|
|
|
|
|
|
|
// clean up
|
|
|
|
fs.rmdirSync(OUTPUT_DIR, { recursive: true })
|