Skip to content

Commit

Permalink
Merge pull request #818 from amnezia-vpn/bugfix/dockerfile-copy
Browse files Browse the repository at this point in the history
added deleting dockerfile before copying
  • Loading branch information
pokamest authored May 21, 2024
2 parents 2649dba + 8f9acd9 commit 53746f2
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions client/core/controllers/serverController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,25 +416,30 @@ ErrorCode ServerController::prepareHostWorker(const ServerCredentials &credentia

ErrorCode ServerController::buildContainerWorker(const ServerCredentials &credentials, DockerContainer container, const QJsonObject &config)
{
ErrorCode e = uploadFileToHost(credentials, amnezia::scriptData(ProtocolScriptType::dockerfile, container).toUtf8(),
amnezia::server::getDockerfileFolder(container) + "/Dockerfile");
QString dockerFilePath = amnezia::server::getDockerfileFolder(container) + "/Dockerfile";
QString scriptString = QString("sudo rm %1").arg(dockerFilePath);
ErrorCode errorCode = runScript(credentials, replaceVars(scriptString, genVarsForScript(credentials, container)));
if (errorCode)
return errorCode;

if (e)
return e;
errorCode = uploadFileToHost(credentials, amnezia::scriptData(ProtocolScriptType::dockerfile, container).toUtf8(),dockerFilePath);

if (errorCode)
return errorCode;

QString stdOut;
auto cbReadStdOut = [&](const QString &data, libssh::Client &) {
stdOut += data + "\n";
return ErrorCode::NoError;
};

e = runScript(credentials,
errorCode = runScript(credentials,
replaceVars(amnezia::scriptData(SharedScriptType::build_container), genVarsForScript(credentials, container, config)),
cbReadStdOut);
if (e)
return e;
if (errorCode)
return errorCode;

return e;
return errorCode;
}

ErrorCode ServerController::runContainerWorker(const ServerCredentials &credentials, DockerContainer container, QJsonObject &config)
Expand Down

0 comments on commit 53746f2

Please sign in to comment.