Files
zeekay ea80dc3638 feat: Add new Dockerfiles and improve containerization
- Add main Dockerfile for production builds
- Add Dockerfile.runtime for secure code execution
- Add Dockerfile.runtime.fixed with improved configuration
- Include .dockerignore for build optimization
- Add integration documentation and publishing guides
- Update API and CLI components for better runtime support
- Enhance sandbox and container management features
2025-08-16 23:03:39 -05:00

49 lines
846 B
Go

// Copyright 2025 Hanzo Industries Inc.
// SPDX-License-Identifier: AGPL-3.0
package daemon
import (
"fmt"
"os"
"path/filepath"
)
func WriteStaticBinary(name string) (string, error) {
daemonBinary, err := static.ReadFile(fmt.Sprintf("static/%s", name))
if err != nil {
return "", err
}
pwd, err := os.Getwd()
if err != nil {
return "", err
}
tmpBinariesDir := filepath.Join(pwd, ".tmp", "binaries")
err = os.MkdirAll(tmpBinariesDir, 0755)
if err != nil {
return "", err
}
daemonPath := filepath.Join(tmpBinariesDir, name)
_, err = os.Stat(daemonPath)
if err != nil && !os.IsNotExist(err) {
return "", err
}
if err == nil {
err = os.Remove(daemonPath)
if err != nil {
return "", err
}
}
err = os.WriteFile(daemonPath, daemonBinary, 0755)
if err != nil {
return "", err
}
return daemonPath, nil
}