Fix busy spinner implementation

This commit is contained in:
mrkmntal 2026-08-14 16:18:12 -04:00
commit 0282d333c2
4 changed files with 40 additions and 87 deletions

View file

@ -204,48 +204,3 @@ bool DockerManager::execDetachedCommand(const std::string& id,
if (ok) message = "Command dispatched in detached mode.";
return ok;
}
bool DockerManager::spinUpMySQL(const std::string& port,
const std::string& password,
const std::string& version,
std::string& message) const {
const bool ok = runProcess({"docker", "run", "-p", port, "--name", "mysql-container",
"-e", "MYSQL_ROOT_PASSWORD=" + password, "-d", "mysql:" + version}, message);
if (ok) message = "MySQL container launched.";
return ok;
}
bool DockerManager::createDockerfile(const std::string& baseImage,
const std::string& bashScriptPath,
std::string outputFile,
const std::string& imageName,
std::string& message) const {
if (baseImage.empty() || bashScriptPath.empty()) {
message = "Base image and script path are required.";
return false;
}
if (!std::filesystem::exists(bashScriptPath)) {
message = "Could not find that script file.";
return false;
}
if (outputFile.empty()) outputFile = "Dockerfile";
std::ifstream scriptFile(bashScriptPath);
std::ofstream dockerfile(outputFile);
if (!scriptFile.is_open() || !dockerfile.is_open()) {
message = "Could not open one of the files.";
return false;
}
dockerfile << "FROM " << baseImage << "\nWORKDIR /app\n\n# Auto-generated by Tux-Dock\n";
std::string line;
while (std::getline(scriptFile, line)) {
if (!line.empty() && line.rfind("#", 0) != 0) dockerfile << "RUN " << line << "\n";
}
dockerfile << "\nCMD [\"/bin/bash\"]\n";
if (imageName.empty()) {
message = "Dockerfile created. Build skipped because no image name was provided.";
return true;
}
const bool ok = runProcess({"docker", "build", "-t", imageName, "-f", outputFile, "."}, message);
if (ok) message = "Dockerfile created and image build completed.";
return ok;
}

View file

@ -44,16 +44,6 @@ public:
bool execDetachedCommand(const std::string& containerId,
const std::string& command,
std::string& message) const;
bool spinUpMySQL(const std::string& port,
const std::string& password,
const std::string& version,
std::string& message) const;
bool createDockerfile(const std::string& baseImage,
const std::string& bashScriptPath,
std::string outputFile,
const std::string& imageName,
std::string& message) const;
private:
DockerEngineClient engine_;