[Fix] - app activation issue

This commit is contained in:
lalitdeore12@gmail.com
2025-09-02 15:13:01 +05:30
parent 67cd5a3e60
commit 98d8a2c990
2 changed files with 41 additions and 10 deletions
+29
View File
@@ -3326,6 +3326,35 @@ func buildSwaggerApp(resp http.ResponseWriter, body []byte, user shuffle.User, s
log.Printf("[INFO] Successfully stitched ZIPFILE for %s", identifier)
// Copy baseline Dockerfile to build directory
dockerfileSource := "../app_gen/python-lib/baseline/Dockerfile"
dockerfileDestination := fmt.Sprintf("%s/Dockerfile", basePath)
// Read and copy the baseline Dockerfile
dockerfileContent, err := ioutil.ReadFile(dockerfileSource)
if err != nil {
log.Printf("[ERROR] Failed to read baseline Dockerfile: %s", err)
resp.WriteHeader(500)
resp.Write([]byte(`{"success": false, "reason": "Failed to read baseline Dockerfile"}`))
return
}
err = ioutil.WriteFile(dockerfileDestination, dockerfileContent, 0644)
if err != nil {
log.Printf("[ERROR] Failed to copy Dockerfile to build directory: %s", err)
resp.WriteHeader(500)
resp.Write([]byte(`{"success": false, "reason": "Failed to copy Dockerfile"}`))
return
}
// Verify the Dockerfile was created
if _, err := os.Stat(dockerfileDestination); os.IsNotExist(err) {
log.Printf("[ERROR] Dockerfile does not exist at destination: %s", dockerfileDestination)
resp.WriteHeader(500)
resp.Write([]byte(`{"success": false, "reason": "Dockerfile was not created properly"}`))
return
}
// 4. Build the image locally.
// FIXME: Should be moved to a local docker registry
dockerLocation := fmt.Sprintf("%s/Dockerfile", basePath)