zz
This commit is contained in:
17
serve.sh
17
serve.sh
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user