Add 16 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 8s
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 8s
This commit is contained in:
23
caddy-static/start.sh
Executable file
23
caddy-static/start.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
|
||||
_check_required_env_vars "CONTAINER_NAME" "HTTP_PORT" "STATIC_DIR"
|
||||
|
||||
# Verify static directory exists
|
||||
[ -d "${STATIC_DIR}" ] || _die "Static directory does not exist: ${STATIC_DIR}"
|
||||
|
||||
# Remove existing container if stopped
|
||||
_remove_container "$CONTAINER_NAME" 2>/dev/null || true
|
||||
|
||||
# Start Caddy with file-server command
|
||||
docker run -d \
|
||||
--name "${CONTAINER_NAME}" \
|
||||
--restart unless-stopped \
|
||||
-p "${HTTP_PORT}:80" \
|
||||
-v "${STATIC_DIR}:/srv:ro" \
|
||||
caddy:alpine \
|
||||
caddy file-server --root /srv --listen :80 \
|
||||
|| _die "Failed to start container"
|
||||
|
||||
echo "Started ${CONTAINER_NAME} on port ${HTTP_PORT}"
|
||||
Reference in New Issue
Block a user