This commit is contained in:
2025-12-07 17:11:07 +06:00
parent b46968519e
commit fd9a69c679
2 changed files with 22 additions and 8 deletions

View File

@@ -2,17 +2,17 @@
WEB_CONTAINER="gentoo_binhost_server"
WEB_PORT="8080"
VOLUME_NAME="binpkgs"
echo "Checking Web Server..."
podman volume inspect "$VOLUME_NAME" >/dev/null 2>&1 || podman volume create "$VOLUME_NAME"
if ! podman container exists "$WEB_CONTAINER"; then
echo "Starting Nginx binhost server on port $WEB_PORT..."
echo "Creating Nginx binhost server on port $WEB_PORT..."
podman run -d \
--name "$WEB_CONTAINER" \
--restart always \
-p "$WEB_PORT":80 \
-v binpkgs:/usr/share/nginx/html:ro \
-v "$VOLUME_NAME":/usr/share/nginx/html:ro \
nginx:alpine \
/bin/sh -c '
echo "server {
@@ -23,6 +23,11 @@ if ! podman container exists "$WEB_CONTAINER"; then
}
}" > /etc/nginx/conf.d/default.conf && nginx -g "daemon off;"'
else
podman start "$WEB_CONTAINER" >/dev/null 2>&1
echo "Server is running at http://localhost:$WEB_PORT"
if [ "$(podman container inspect -f '{{.State.Running}}' "$WEB_CONTAINER")" != "true" ]; then
echo "Starting existing server..."
podman start "$WEB_CONTAINER"
fi
fi
echo "Binhost serving at http://localhost:$WEB_PORT"