Add build-push script and update API queries

This commit is contained in:
Dede Fuji Abdul
2024-03-31 10:03:10 +07:00
parent 6bfa78010e
commit 53ff89e7fe
4 changed files with 122 additions and 14 deletions

29
build-push.js Normal file
View File

@ -0,0 +1,29 @@
// build-and-push.js
const { exec } = require('child_process')
function buildAndPush(version) {
const dockerImageTag = `defuj/apkt-eis:${version}`
const command = `npm run build && docker build . -t ${dockerImageTag} && docker push ${dockerImageTag}`
exec(command, (error, stdout, stderr) => {
if (error) {
console.error(`Error: ${error.message}`)
return
}
if (stderr) {
console.error(`stderr: ${stderr}`)
return
}
console.log(`stdout: ${stdout}`)
})
}
// Ambil argumen versi dari command line
const version = process.argv[2]
if (!version) {
console.error('Usage: node build-push.js <version>')
process.exit(1)
}
buildAndPush(version)