Add production Docker deployment
Amp-Thread-ID: https://ampcode.com/threads/T-01a02485-5574-707c-bff4-5668d83bee8a Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
+6
-3
@@ -33,7 +33,10 @@ func buildPackages(root string) (map[string]memoryAsset, error) {
|
||||
if err := runBuild(root, "node", filepath.Join(root, "server", "build.mjs"), root, output); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return loadPackages(output)
|
||||
}
|
||||
|
||||
func loadPackages(directory string) (map[string]memoryAsset, error) {
|
||||
assets := make(map[string]memoryAsset)
|
||||
for _, name := range []string{
|
||||
"core.js",
|
||||
@@ -42,21 +45,21 @@ func buildPackages(root string) (map[string]memoryAsset, error) {
|
||||
"importer-worker.js",
|
||||
"bvh-worker.js",
|
||||
} {
|
||||
asset, err := loadMemoryAsset(filepath.Join(output, name))
|
||||
asset, err := loadMemoryAsset(filepath.Join(directory, name))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
assets[name] = asset
|
||||
}
|
||||
|
||||
err = filepath.WalkDir(filepath.Join(output, "pkg"), func(path string, entry fs.DirEntry, walkErr error) error {
|
||||
err := filepath.WalkDir(filepath.Join(directory, "pkg"), func(path string, entry fs.DirEntry, walkErr error) error {
|
||||
if walkErr != nil {
|
||||
return walkErr
|
||||
}
|
||||
if entry.IsDir() {
|
||||
return nil
|
||||
}
|
||||
relative, err := filepath.Rel(filepath.Join(output, "pkg"), path)
|
||||
relative, err := filepath.Rel(filepath.Join(directory, "pkg"), path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user