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 <noreply@anthropic.com>
This commit is contained in:
parent
c50bc8601d
commit
be5e2a5e7c
3 changed files with 49 additions and 0 deletions
30
deploy.sh
Normal file
30
deploy.sh
Normal file
|
|
@ -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"
|
||||
18
docker-compose.yml
Normal file
18
docker-compose.yml
Normal file
|
|
@ -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
|
||||
|
|
@ -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: [
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue