Skip to content

Commit f61c14c

Browse files
committed
Improve Docker welcome banner with structured login flow
1 parent 400982b commit f61c14c

1 file changed

Lines changed: 45 additions & 2 deletions

File tree

packages/core/src/docker/files/entrypoint.sh

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,60 @@ read_opencode_cloud_version() {
2222
fi
2323
}
2424

25+
format_url_host() {
26+
local host="$1"
27+
28+
if [[ "${host}" == *:* ]] && [[ "${host}" != \[*] ]]; then
29+
printf "[%s]" "${host}"
30+
else
31+
printf "%s" "${host}"
32+
fi
33+
}
34+
35+
display_local_host() {
36+
local host="$1"
37+
38+
if [ "${host}" = "0.0.0.0" ] || [ "${host}" = "::" ]; then
39+
printf "127.0.0.1"
40+
else
41+
printf "%s" "${host}"
42+
fi
43+
}
44+
45+
build_service_url() {
46+
local host="$1"
47+
local port="$2"
48+
printf "http://%s:%s" "$(format_url_host "${host}")" "${port}"
49+
}
50+
2551
print_welcome_banner() {
26-
local version
52+
local version local_host local_url bind_url
2753
version="$(read_opencode_cloud_version)"
54+
local_host="$(display_local_host "${OPENCODE_HOST}")"
55+
local_url="$(build_service_url "${local_host}" "${OPENCODE_PORT}")"
56+
bind_url="$(build_service_url "${OPENCODE_HOST}" "${OPENCODE_PORT}")"
2857

2958
log "----------------------------------------------------------------------"
3059
log "Welcome to opencode-cloud-sandbox"
3160
log "You are running opencode-cloud v${version}"
3261
log "For questions, problems, and feature requests, file an issue:"
3362
log " https://github.com/pRizz/opencode-cloud/issues"
3463
log "opencode-cloud runs opencode in a Docker sandbox; use occ/opencode-cloud CLI to manage users, mounts, and updates."
35-
log "Quick start: occ user add <username> | occ status | occ logs -f"
64+
log ""
65+
log "Getting started:"
66+
log " 1) Create a login user:"
67+
log " occ user add <username>"
68+
log " 2) Set or generate a password:"
69+
log " occ user add <username> --generate"
70+
log " occ user passwd <username>"
71+
log " occ user passwd <username> --generate"
72+
log " 3) Access the web UI:"
73+
log " Local URL: ${local_url}"
74+
log " Bind URL: ${bind_url}"
75+
log " 4) Cloud note: external URL may differ based on DNS, reverse proxy/load balancer,"
76+
log " ingress, TLS termination, and port mappings."
77+
log " 5) Log in with your created credentials. If prompted for optional 2FA setup,"
78+
log " you can skip it."
3679
log "Docs: https://github.com/pRizz/opencode-cloud#readme"
3780
log "----------------------------------------------------------------------"
3881
}

0 commit comments

Comments
 (0)