Fix Docker deployment inputs

Include all addon workspaces and vendored dependencies in image builds, and expose deploy time plus commit metadata on the home page.

Amp-Thread-ID: https://ampcode.com/threads/T-01a033d4-0e44-708e-af0e-6166283416ff
Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-08-24 18:30:45 +00:00
co-authored by heaust
parent 6153223fd5
commit d71da85307
6 changed files with 61 additions and 5 deletions
+24
View File
@@ -13,6 +13,7 @@ import (
"path"
"strconv"
"strings"
"time"
)
//go:embed web
@@ -40,6 +41,13 @@ func newApplication(store *playgroundStore, packages map[string]memoryAsset, mon
if err != nil {
return nil, err
}
if name == "home.html" {
logMessage, err := json.Marshal(deploymentLogMessage())
if err != nil {
return nil, err
}
content = bytes.Replace(content, []byte("__YAWN_DEPLOYMENT_LOG__"), logMessage, 1)
}
pages[name] = content
}
return &application{
@@ -51,6 +59,22 @@ func newApplication(store *playgroundStore, packages map[string]memoryAsset, mon
}, nil
}
func deploymentLogMessage() string {
deployedAt := "unknown"
if value := os.Getenv("YAWN_DEPLOYED_AT"); value != "" {
deployedAt = value
if parsed, err := time.Parse(time.RFC3339, value); err == nil {
ist := time.FixedZone("IST", 5*60*60+30*60)
deployedAt = parsed.In(ist).Format("2 January 2006, 03:04:05 PM MST")
}
}
commitMessage := strings.TrimSpace(os.Getenv("YAWN_DEPLOY_COMMIT_MESSAGE"))
if commitMessage == "" {
commitMessage = "unknown"
}
return fmt.Sprintf("Yawn deployed at %s\nLatest commit: %s", deployedAt, commitMessage)
}
func (app *application) routes() http.Handler {
mux := http.NewServeMux()
mux.HandleFunc("/healthz", app.health)