Split compose dev/prod and relax contact form friction.
Use compose.dev.yaml and compose.prod.yaml with fixed Go cache mounts, block sudo make dev, build Air outside app/tmp for rootless Docker, soften English spam checks, and simplify contact error copy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
29
Makefile
29
Makefile
@@ -1,12 +1,15 @@
|
||||
COMPOSE ?= docker compose
|
||||
COMPOSE_DEV := $(COMPOSE) -f compose.dev.yaml
|
||||
COMPOSE_PROD := $(COMPOSE) -f compose.prod.yaml
|
||||
|
||||
# Compose does not support nested ${VAR:-${HOME}/...}; set defaults here (override in .env).
|
||||
# Compose does not support nested ${VAR:-${HOME}/...}; set host cache paths here (override in .env).
|
||||
-include .env
|
||||
export GOMODCACHE ?= $(HOME)/go/pkg/mod
|
||||
export GOCACHE ?= $(HOME)/.cache/go-build
|
||||
HOST_GOMODCACHE := $(if $(strip $(GOMODCACHE)),$(strip $(GOMODCACHE)),$(HOME)/go/pkg/mod)
|
||||
HOST_GOCACHE := $(if $(strip $(GOCACHE)),$(strip $(GOCACHE)),$(HOME)/.cache/go-build)
|
||||
export HOST_GOMODCACHE HOST_GOCACHE
|
||||
|
||||
# One-off commands in the dev image (same caches and ./app mount as `make dev`)
|
||||
DEV_RUN := $(COMPOSE) run --rm --no-deps -T dev
|
||||
DEV_ENV := env HOST_GOMODCACHE="$(HOST_GOMODCACHE)" HOST_GOCACHE="$(HOST_GOCACHE)"
|
||||
DEV_RUN := $(DEV_ENV) $(COMPOSE_DEV) run --rm --no-deps -T dev
|
||||
|
||||
.PHONY: dev build up down generate tidy logs thumbs sync-media publish convert-videos
|
||||
|
||||
@@ -14,17 +17,23 @@ DEV_RUN := $(COMPOSE) run --rm --no-deps -T dev
|
||||
|
||||
dev:
|
||||
@test -f .env || cp -n .env.example .env
|
||||
$(COMPOSE) up --build dev
|
||||
@if [ "$$(id -u)" = "0" ]; then \
|
||||
echo "Do not run 'sudo make dev' — it creates root-owned files under app/ and breaks rootless Docker."; \
|
||||
echo "Run: make dev"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(DEV_ENV) $(COMPOSE_DEV) up --build dev
|
||||
|
||||
build:
|
||||
$(COMPOSE) build website
|
||||
$(COMPOSE_PROD) build website
|
||||
|
||||
up:
|
||||
@test -f .env || cp -n .env.example .env
|
||||
$(COMPOSE) up --build website
|
||||
$(COMPOSE_PROD) up --build website
|
||||
|
||||
down:
|
||||
$(COMPOSE) down
|
||||
-$(COMPOSE_DEV) down
|
||||
-$(COMPOSE_PROD) down
|
||||
|
||||
generate:
|
||||
$(DEV_RUN) sh -c "templ generate"
|
||||
@@ -33,7 +42,7 @@ tidy:
|
||||
$(DEV_RUN) go mod tidy
|
||||
|
||||
logs:
|
||||
$(COMPOSE) logs -f dev
|
||||
$(COMPOSE_DEV) logs -f dev
|
||||
|
||||
# Pre-build gallery thumbnails and video poster JPEGs (ffmpeg in dev image).
|
||||
thumbs:
|
||||
|
||||
Reference in New Issue
Block a user