Migrate to warehack.ing deployment convention
Single compose file with profiles, standardized Makefile targets, .dockerignore for lean builds, production domain mcnanovna.warehack.ing.
This commit is contained in:
parent
5edac3007c
commit
6314313e1f
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
dist
|
||||
.git
|
||||
.env
|
||||
*.md
|
||||
@ -1,8 +1,3 @@
|
||||
# Project identifier (prevents container name collisions)
|
||||
COMPOSE_PROJECT=mcnanovna-docs
|
||||
|
||||
# Domain for caddy-docker-proxy
|
||||
DOMAIN=mcnanovna.l.zmesh.systems
|
||||
|
||||
# Mode: prod or dev (used by Makefile to select compose files)
|
||||
DOMAIN=mcnanovna.warehack.ing
|
||||
MODE=prod
|
||||
|
||||
68
Makefile
68
Makefile
@ -1,77 +1,45 @@
|
||||
# mcnanovna docs - Makefile for docker compose management
|
||||
# Usage:
|
||||
# make up - Start production (static site)
|
||||
# make dev - Start development (hot-reload)
|
||||
# make down - Stop containers
|
||||
# make logs - Follow container logs
|
||||
# make build - Rebuild container images
|
||||
# make shell - Open shell in running container
|
||||
.PHONY: prod dev down logs build rebuild shell clean help
|
||||
|
||||
.PHONY: up down logs build rebuild shell dev clean help
|
||||
|
||||
# Load environment variables
|
||||
include .env
|
||||
export
|
||||
|
||||
# Compose command shortcuts
|
||||
COMPOSE := docker compose
|
||||
COMPOSE_DEV := docker compose -f docker-compose.yml -f docker-compose.dev.yml
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@echo "mcnanovna docs - Astro/Starlight documentation site"
|
||||
@echo "mcnanovna docs"
|
||||
@echo ""
|
||||
@echo "Usage:"
|
||||
@echo " make up Start production (static Caddy server)"
|
||||
@echo " make dev Start development (Vite hot-reload)"
|
||||
@echo " make down Stop all containers"
|
||||
@echo " make logs Follow container logs"
|
||||
@echo " make build Build production image"
|
||||
@echo " make prod Production (static Caddy)"
|
||||
@echo " make dev Development (Vite hot-reload)"
|
||||
@echo " make down Stop containers"
|
||||
@echo " make logs Follow logs"
|
||||
@echo " make build Build image"
|
||||
@echo " make rebuild Force rebuild (no cache)"
|
||||
@echo " make shell Open shell in running container"
|
||||
@echo " make shell Shell into running container"
|
||||
@echo " make clean Remove containers, images, volumes"
|
||||
@echo ""
|
||||
@echo "Environment:"
|
||||
@echo " DOMAIN = $(DOMAIN)"
|
||||
@echo " MODE = $(MODE)"
|
||||
|
||||
# Production mode
|
||||
up: .env
|
||||
$(COMPOSE) up -d
|
||||
$(COMPOSE) logs -f
|
||||
prod:
|
||||
docker compose up -d --build
|
||||
|
||||
# Development mode with hot-reload
|
||||
dev: .env
|
||||
$(COMPOSE_DEV) up -d --build
|
||||
$(COMPOSE_DEV) logs -f
|
||||
dev:
|
||||
docker compose --profile dev up --build
|
||||
|
||||
# Stop containers
|
||||
down:
|
||||
$(COMPOSE) down
|
||||
$(COMPOSE_DEV) down 2>/dev/null || true
|
||||
docker compose --profile dev down
|
||||
|
||||
# View logs
|
||||
logs:
|
||||
$(COMPOSE) logs -f
|
||||
docker compose logs -f
|
||||
|
||||
# Build image
|
||||
build:
|
||||
$(COMPOSE) build
|
||||
docker compose build
|
||||
|
||||
# Rebuild without cache
|
||||
rebuild:
|
||||
$(COMPOSE) build --no-cache
|
||||
docker compose build --no-cache
|
||||
|
||||
# Shell into running container
|
||||
shell:
|
||||
$(COMPOSE) exec docs sh
|
||||
docker compose exec docs sh
|
||||
|
||||
# Clean everything
|
||||
clean:
|
||||
$(COMPOSE) down -v --rmi local
|
||||
$(COMPOSE_DEV) down -v --rmi local 2>/dev/null || true
|
||||
docker compose --profile dev down -v --rmi local
|
||||
|
||||
# Create .env from example if missing
|
||||
.env:
|
||||
@echo "Creating .env from .env.example..."
|
||||
@cp .env.example .env
|
||||
|
||||
@ -2,7 +2,7 @@ import { defineConfig } from 'astro/config';
|
||||
import starlight from '@astrojs/starlight';
|
||||
|
||||
export default defineConfig({
|
||||
site: 'https://mcnanovna.l.zmesh.systems',
|
||||
site: 'https://mcnanovna.warehack.ing',
|
||||
telemetry: false,
|
||||
devToolbar: { enabled: false },
|
||||
integrations: [
|
||||
@ -15,7 +15,7 @@ export default defineConfig({
|
||||
replacesTitle: false,
|
||||
},
|
||||
social: {
|
||||
github: 'https://git.supported.systems/rf/mcnanovna',
|
||||
github: 'https://git.supported.systems/warehack.ing/mcnanovna',
|
||||
},
|
||||
sidebar: [
|
||||
{
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
# Development overrides - hot-reload with volume mounts
|
||||
# Usage: docker compose -f docker-compose.yml -f docker-compose.dev.yml up
|
||||
|
||||
services:
|
||||
docs:
|
||||
build:
|
||||
target: dev
|
||||
volumes:
|
||||
- .:/app
|
||||
- /app/node_modules # Anonymous volume to preserve node_modules
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- ASTRO_TELEMETRY_DISABLED=1
|
||||
- VITE_HMR_HOST=${DOMAIN:-mcnanovna.l.zmesh.systems}
|
||||
labels:
|
||||
# Override reverse proxy to Vite dev server port
|
||||
caddy.reverse_proxy: "{{upstreams 4321}}"
|
||||
|
||||
# WebSocket support for Vite HMR
|
||||
caddy.reverse_proxy.flush_interval: "-1"
|
||||
caddy.reverse_proxy.transport: "http"
|
||||
caddy.reverse_proxy.transport.read_timeout: "0"
|
||||
caddy.reverse_proxy.transport.write_timeout: "0"
|
||||
caddy.reverse_proxy.transport.keepalive: "5m"
|
||||
caddy.reverse_proxy.transport.keepalive_idle_conns: "10"
|
||||
caddy.reverse_proxy.stream_timeout: "24h"
|
||||
caddy.reverse_proxy.stream_close_delay: "5s"
|
||||
@ -10,10 +10,38 @@ services:
|
||||
environment:
|
||||
- ASTRO_TELEMETRY_DISABLED=1
|
||||
labels:
|
||||
# caddy-docker-proxy configuration
|
||||
caddy: ${DOMAIN:-mcnanovna.l.zmesh.systems}
|
||||
caddy: ${DOMAIN:-mcnanovna.warehack.ing}
|
||||
caddy.reverse_proxy: "{{upstreams 80}}"
|
||||
|
||||
docs-dev:
|
||||
build:
|
||||
context: .
|
||||
target: dev
|
||||
container_name: ${COMPOSE_PROJECT:-mcnanovna-docs}-dev
|
||||
restart: unless-stopped
|
||||
profiles:
|
||||
- dev
|
||||
networks:
|
||||
- caddy
|
||||
volumes:
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- ASTRO_TELEMETRY_DISABLED=1
|
||||
- VITE_HMR_HOST=${DOMAIN:-mcnanovna.l.warehack.ing}
|
||||
labels:
|
||||
caddy: ${DOMAIN:-mcnanovna.l.warehack.ing}
|
||||
caddy.reverse_proxy: "{{upstreams 4321}}"
|
||||
caddy.reverse_proxy.flush_interval: "-1"
|
||||
caddy.reverse_proxy.transport: "http"
|
||||
caddy.reverse_proxy.transport.read_timeout: "0"
|
||||
caddy.reverse_proxy.transport.write_timeout: "0"
|
||||
caddy.reverse_proxy.transport.keepalive: "5m"
|
||||
caddy.reverse_proxy.transport.keepalive_idle_conns: "10"
|
||||
caddy.reverse_proxy.stream_timeout: "24h"
|
||||
caddy.reverse_proxy.stream_close_delay: "5s"
|
||||
|
||||
networks:
|
||||
caddy:
|
||||
external: true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user