Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(check the installed docker version): script to check version #1810

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions dependency.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* eslint-disable no-console */
const { exec } = require('child_process');

const versionDockerNeeded = 20;
const versionComposeNeeded = 1.29;

exec('docker -v', (err, stdout, stderr) => {
// eslint-disable-line no-console
if (err) {
console.error('error', stderr);
console.error('❌️ Instalação do Docker não foi localizada, verificar as dependencias do projeto no link');
console.error('https://github.com/filipedeschamps/tabnews.com.br');
exec('killall node');
} else {
const version = stdout.split(' ')[2];
const versionNumber = version.split('.')[0];
if (versionNumber < versionDockerNeeded) {
console.error(
'❌️ Instalação do Docker é inferior a necessária para rodar o projeto, verificar as dependencias do projeto no link',
);
console.error(`❌️ ${stdout} `);
console.error('https://github.com/filipedeschamps/tabnews.com.br');
exec('killall node');
} else {
console.log(`✓ ${stdout} `);
}
}
});

exec('docker compose version', (err, stdout, stderr) => {
if (err) {
console.error('error', stderr);
console.error('❌️ Plugin compose no Docker não foi localizada, verificar as dependencias do projeto no link');
console.error('https://github.com/filipedeschamps/tabnews.com.br');
exec('killall node');
} else {
const version = stdout.split('version v')[1];
const versionNumber = version.split('.');
if (versionNumber[0] + '.' + versionNumber[1] < versionComposeNeeded) {
console.error(
'❌️ Instalação do plugin compose no Docker é inferior a necessária para rodar o projeto, verificar as dependencias do projeto no link',
);
console.error(`❌️ ${stdout} `);
console.error('https://github.com/filipedeschamps/tabnews.com.br');
exec('killall node');
} else {
console.log(`✓ ${stdout} `);
}
}
});
Loading