From 7fdac42ec7a7ce0eb734e35c977038a48f62d217 Mon Sep 17 00:00:00 2001 From: thefoxcost Date: Fri, 28 Nov 2025 13:46:32 -0800 Subject: [PATCH] Add bash script to clone VERT, build Docker image, and run container --- app.sh | 0 run_vert.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) delete mode 100644 app.sh create mode 100644 run_vert.sh diff --git a/app.sh b/app.sh deleted file mode 100644 index e69de29..0000000 diff --git a/run_vert.sh b/run_vert.sh new file mode 100644 index 0000000..2b56673 --- /dev/null +++ b/run_vert.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# VERT Docker Setup Script +# This script clones VERT, builds a Docker image, and runs it. + +# Configuration +REPO_URL="https://github.com/VERT-sh/VERT" +IMAGE_NAME="vert-sh/vert" +CONTAINER_NAME="vert" +HOST_PORT=3000 +CONTAINER_PORT=80 + +# Build-time environment variables +PUB_ENV="production" +PUB_HOSTNAME="vert.sh" +PUB_PLAUSIBLE_URL="https://plausible.example.com" +PUB_VERTD_URL="https://vertd.vert.sh" +PUB_DONATION_URL="https://donations.vert.sh" +PUB_DISABLE_ALL_EXTERNAL_REQUESTS="false" +PUB_STRIPE_KEY="" + +# Choose mode: "build" to build from repo, "pull" to use GitHub Container Registry +MODE="build" + +if [[ "$MODE" == "build" ]]; then + echo "Cloning repository..." + git clone "$REPO_URL" + cd VERT || { echo "Failed to enter VERT directory"; exit 1; } + + echo "Building Docker image..." + docker build -t "$IMAGE_NAME" \ + --build-arg PUB_ENV="$PUB_ENV" \ + --build-arg PUB_HOSTNAME="$PUB_HOSTNAME" \ + --build-arg PUB_PLAUSIBLE_URL="$PUB_PLAUSIBLE_URL" \ + --build-arg PUB_VERTD_URL="$PUB_VERTD_URL" \ + --build-arg PUB_DONATION_URL="$PUB_DONATION_URL" \ + --build-arg PUB_DISABLE_ALL_EXTERNAL_REQUESTS="$PUB_DISABLE_ALL_EXTERNAL_REQUESTS" \ + --build-arg PUB_STRIPE_KEY="$PUB_STRIPE_KEY" \ + . + +elif [[ "$MODE" == "pull" ]]; then + echo "Pulling prebuilt image from GitHub Container Registry..." + IMAGE_NAME="ghcr.io/vert-sh/vert:latest" + docker pull "$IMAGE_NAME" +else + echo "Invalid MODE. Use 'build' or 'pull'." + exit 1 +fi + +# Stop and remove existing container if it exists +if docker ps -a --format '{{.Names}}' | grep -Eq "^${CONTAINER_NAME}\$"; then + echo "Stopping existing container..." + docker stop "$CONTAINER_NAME" + echo "Removing existing container..." + docker rm "$CONTAINER_NAME" +fi + +# Run container +echo "Running container..." +docker run -d \ + --restart unless-stopped \ + -p "$HOST_PORT":"$CONTAINER_PORT" \ + --name "$CONTAINER_NAME" \ + "$IMAGE_NAME" + +echo "VERT is now running on port $HOST_PORT!"