diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 00000000..573074e7 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -e + +DEPLOY_DIR="/opt/homepage" +REPO="git@bitbucket.org:zlalani/homepage.git" + +echo "=== Homepage Deploy ===" + +if [ ! -d "$DEPLOY_DIR/.git" ]; then + echo "Cloning repository..." + git clone "$REPO" "$DEPLOY_DIR" + cd "$DEPLOY_DIR" +else + echo "Pulling latest changes..." + cd "$DEPLOY_DIR" + git pull origin dev +fi + +mkdir -p config + +echo "Building and starting container..." +docker compose build --no-cache +docker compose up -d + +echo "Waiting for healthcheck..." +sleep 15 +docker compose ps + +echo "" +echo "Done. Homepage available at https://optical-dev.oliver.solutions/homepage" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..9dd95c87 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +services: + app: + build: + context: . + args: + NEXT_PUBLIC_BASE_PATH: /homepage + ports: + - "127.0.0.1:3001:3000" + volumes: + - ./config:/app/config + - /var/run/docker.sock:/var/run/docker.sock:ro + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/api/healthcheck || exit 1"] + interval: 10s + timeout: 3s + start_period: 30s + retries: 3 diff --git a/next.config.js b/next.config.js index ea49bf54..95cd59dd 100644 --- a/next.config.js +++ b/next.config.js @@ -4,6 +4,7 @@ const { i18n } = require("./next-i18next.config"); const nextConfig = { reactStrictMode: true, output: "standalone", + basePath: process.env.NEXT_PUBLIC_BASE_PATH || "", images: { remotePatterns: [ {