mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-10 10:02:36 +01:00
🏷️ chore: Remove Docker Images by Named Tag in deployed-update.js (#12138)
* fix: remove docker images by named tag instead of image ID * refactor: Simplify rebase logic and enhance error handling in deployed-update script - Removed unnecessary condition for rebasing, streamlining the update process. - Renamed variable for clarity when fetching Docker image tags. - Added error handling to catch and log failures during the update process, ensuring better visibility of issues.
This commit is contained in:
parent
4a8a5b5994
commit
8b18a16446
1 changed files with 13 additions and 7 deletions
|
|
@ -29,7 +29,7 @@ const shouldRebase = process.argv.includes('--rebase');
|
||||||
execSync('git checkout main', { stdio: 'inherit' });
|
execSync('git checkout main', { stdio: 'inherit' });
|
||||||
console.purple('Pulling the latest code from main...');
|
console.purple('Pulling the latest code from main...');
|
||||||
execSync('git pull origin main', { stdio: 'inherit' });
|
execSync('git pull origin main', { stdio: 'inherit' });
|
||||||
} else if (shouldRebase) {
|
} else {
|
||||||
const currentBranch = getCurrentBranch();
|
const currentBranch = getCurrentBranch();
|
||||||
console.purple(`Rebasing ${currentBranch} onto main...`);
|
console.purple(`Rebasing ${currentBranch} onto main...`);
|
||||||
execSync('git rebase origin/main', { stdio: 'inherit' });
|
execSync('git rebase origin/main', { stdio: 'inherit' });
|
||||||
|
|
@ -43,11 +43,14 @@ const shouldRebase = process.argv.includes('--rebase');
|
||||||
console.purple('Removing all tags for LibreChat `deployed` images...');
|
console.purple('Removing all tags for LibreChat `deployed` images...');
|
||||||
const repositories = ['registry.librechat.ai/danny-avila/librechat-dev-api', 'librechat-client'];
|
const repositories = ['registry.librechat.ai/danny-avila/librechat-dev-api', 'librechat-client'];
|
||||||
repositories.forEach((repo) => {
|
repositories.forEach((repo) => {
|
||||||
const tags = execSync(`sudo docker images ${repo} -q`, { encoding: 'utf8' })
|
const imageRefs = execSync(`sudo docker images ${repo} --format "{{.Repository}}:{{.Tag}}"`, {
|
||||||
|
encoding: 'utf8',
|
||||||
|
})
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter(Boolean);
|
.filter(Boolean)
|
||||||
tags.forEach((tag) => {
|
.filter((ref) => !ref.includes('<none>'));
|
||||||
const removeImageCommand = `sudo docker rmi ${tag}`;
|
imageRefs.forEach((imageRef) => {
|
||||||
|
const removeImageCommand = `sudo docker rmi ${imageRef}`;
|
||||||
console.orange(removeImageCommand);
|
console.orange(removeImageCommand);
|
||||||
execSync(removeImageCommand, { stdio: 'inherit' });
|
execSync(removeImageCommand, { stdio: 'inherit' });
|
||||||
});
|
});
|
||||||
|
|
@ -58,11 +61,14 @@ const shouldRebase = process.argv.includes('--rebase');
|
||||||
console.orange(pullCommand);
|
console.orange(pullCommand);
|
||||||
execSync(pullCommand, { stdio: 'inherit' });
|
execSync(pullCommand, { stdio: 'inherit' });
|
||||||
|
|
||||||
let startCommand = 'sudo docker compose -f ./deploy-compose.yml up -d';
|
const startCommand = 'sudo docker compose -f ./deploy-compose.yml up -d';
|
||||||
console.green('Your LibreChat app is now up to date! Start the app with the following command:');
|
console.green('Your LibreChat app is now up to date! Start the app with the following command:');
|
||||||
console.purple(startCommand);
|
console.purple(startCommand);
|
||||||
console.orange(
|
console.orange(
|
||||||
"Note: it's also recommended to clear your browser cookies and localStorage for LibreChat to assure a fully clean installation.",
|
"Note: it's also recommended to clear your browser cookies and localStorage for LibreChat to assure a fully clean installation.",
|
||||||
);
|
);
|
||||||
console.orange("Also: Don't worry, your data is safe :)");
|
console.orange("Also: Don't worry, your data is safe :)");
|
||||||
})();
|
})().catch((err) => {
|
||||||
|
console.error('Update script failed:', err.message);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue