From be5e2a5e7c0f6c6ff6c29103d2749a42defe6607 Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Wed, 1 Apr 2026 12:27:45 +0100 Subject: [PATCH] Deploy: add basePath support and server docker-compose - next.config.js: basePath from NEXT_PUBLIC_BASE_PATH env var (build arg) - docker-compose.yml: builds with /homepage base path, exposes :3001 locally, mounts config dir and Docker socket - deploy.sh: clone/pull + build + start script for optical-dev server Co-Authored-By: Claude Sonnet 4.6 --- deploy.sh | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 18 ++++++++++++++++++ next.config.js | 1 + 3 files changed, 49 insertions(+) create mode 100644 deploy.sh create mode 100644 docker-compose.yml 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: [ {