refactor(scripts): centralize static files collection in Docker entrypoint
Moved static files collection from platform-specific scripts to the Docker entrypoint script. Simplifies maintenance by eliminating redundant logic across Windows, Unix, and restart scripts. Updated logo/icon settings to use `static()` for better flexibility.
This commit is contained in:
parent
52687beeec
commit
18bb585a13
6 changed files with 3 additions and 32 deletions
|
|
@ -34,8 +34,8 @@ UNFOLD: dict[str, Any] = {
|
||||||
"SITE_URL": STOREFRONT_DOMAIN,
|
"SITE_URL": STOREFRONT_DOMAIN,
|
||||||
"SITE_TITLE": f"{PROJECT_NAME} Dashboard",
|
"SITE_TITLE": f"{PROJECT_NAME} Dashboard",
|
||||||
"SITE_HEADER": PROJECT_NAME,
|
"SITE_HEADER": PROJECT_NAME,
|
||||||
"SITE_LOGO": "favicon.png",
|
"SITE_LOGO": lambda request: static("favicon.png"),
|
||||||
"SITE_ICON": "favicon.ico",
|
"SITE_ICON": lambda request: static("favicon.ico"),
|
||||||
"SITE_SYMBOL": "money",
|
"SITE_SYMBOL": "money",
|
||||||
"SITE_DROPDOWN": [
|
"SITE_DROPDOWN": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
uv run manage.py await_services
|
uv run manage.py await_services
|
||||||
|
uv run manage.py collectstatic --noinput --verbosity 0
|
||||||
|
|
||||||
if [ "${DEBUG:-0}" = "1" ]; then
|
if [ "${DEBUG:-0}" = "1" ]; then
|
||||||
uv run uvicorn --host 0.0.0.0 --port 8000 --reload --log-level debug --ws-ping-interval 20 --ws-ping-timeout 20 schon.asgi:application
|
uv run uvicorn --host 0.0.0.0 --port 8000 --reload --log-level debug --ws-ping-interval 20 --ws-ping-timeout 20 schon.asgi:application
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,6 @@ if ! output=$(docker compose exec -T app uv run manage.py search_index --rebuild
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_info " → Collecting static files..."
|
|
||||||
if ! output=$(docker compose exec -T app uv run manage.py collectstatic --clear --no-input --verbosity 0 2>&1); then
|
|
||||||
log_error "Static files collection failed"
|
|
||||||
echo "$output"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_success "Pre-run tasks completed successfully!"
|
log_success "Pre-run tasks completed successfully!"
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
|
|
||||||
|
|
@ -64,13 +64,6 @@ if ! output=$(docker compose exec -T app uv run manage.py search_index --rebuild
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_info " → Collecting static files..."
|
|
||||||
if ! output=$(docker compose exec -T app uv run manage.py collectstatic --clear --no-input --verbosity 0 2>&1); then
|
|
||||||
log_error "Static files collection failed"
|
|
||||||
echo "$output"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_success "Pre-run tasks completed successfully!"
|
log_success "Pre-run tasks completed successfully!"
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
|
|
||||||
|
|
@ -69,14 +69,6 @@ if ($LASTEXITCODE -ne 0) {
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Info " Collecting static files..."
|
|
||||||
$output = docker compose exec -T app uv run manage.py collectstatic --clear --no-input --verbosity 0 2>&1
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
Write-Error-Custom "Static files collection failed"
|
|
||||||
Write-Host $output
|
|
||||||
exit $LASTEXITCODE
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Success "Pre-run tasks completed successfully!"
|
Write-Success "Pre-run tasks completed successfully!"
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
|
|
||||||
|
|
@ -84,14 +84,6 @@ if ($LASTEXITCODE -ne 0) {
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Info " Collecting static files..."
|
|
||||||
$output = docker compose exec -T app uv run manage.py collectstatic --clear --no-input --verbosity 0 2>&1
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
Write-Error-Custom "Static files collection failed"
|
|
||||||
Write-Host $output
|
|
||||||
exit $LASTEXITCODE
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Success "Pre-run tasks completed successfully!"
|
Write-Success "Pre-run tasks completed successfully!"
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue