feat(docker): split compose into dev-forward build and prod pull

docker-compose.yml now builds from source (dev-forward: run your local changes);
docker-compose.prod.yml overrides it to pull ghcr latest (build reset via !reset).
Adds make compose-up / compose-up-prod / compose-down. Env, ports, and extra_hosts
stay defined once in the base file; the prod override only swaps build -> image.
This commit is contained in:
Offending Commit
2026-06-02 13:50:27 -05:00
parent 56b3d18f40
commit c9bd2db07d
3 changed files with 38 additions and 17 deletions

View File

@@ -4,7 +4,8 @@
.PHONY: bootstrap dev dev-web dev-desktop \
build test test-e2e lint lint-fix typecheck check \
ci-web ci-desktop smoke-docker install help
ci-web ci-desktop smoke-docker \
compose-up compose-up-prod compose-down install help
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS=":.*?## "}; {printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}'
@@ -50,5 +51,14 @@ ci-desktop: ## CI: cargo-check for @openconcho/desktop
smoke-docker: ## Local: build the image + smoke-test the /api proxy (Docker required)
bash docker/smoke-test.sh
compose-up: ## Run the web container from source (builds; dev-forward) at :8080
docker compose up -d --build
compose-up-prod: ## Run the web container from the published image (pulls latest)
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
compose-down: ## Stop and remove the web container
docker compose down --remove-orphans
install: ## pnpm install (no playwright)
pnpm install

11
docker-compose.prod.yml Normal file
View File

@@ -0,0 +1,11 @@
# Production override — pull the published image instead of building from source.
# Layer it on top of docker-compose.yml; it reuses every setting there (env, ports,
# extra_hosts) and only swaps the local build for the latest published image.
#
# make compose-up-prod
# docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
services:
openconcho:
build: !reset null
image: ghcr.io/offendingcommit/openconcho-web:latest
pull_policy: always

View File

@@ -1,25 +1,25 @@
# Run OpenConcho's web UI with `docker compose up`.
# OpenConcho web UI — DEV-FORWARD compose (builds from THIS repo).
#
# Standalone: serves the SPA on http://localhost:8080. The browser issues all
# Honcho calls same-origin to /api; nginx forwards each to the URL named in the
# per-request X-Honcho-Upstream header (no browser CORS). Seed the first instance
# with OPENCONCHO_DEFAULT_HONCHO_URL — override for anything else:
# make compose-up # build from source + run → http://localhost:8080
# make compose-up-prod # pull the published image instead (see docker-compose.prod.yml)
# make compose-down # stop + remove
#
# OPENCONCHO_DEFAULT_HONCHO_URL=https://honcho.example.net docker compose up
# The SPA issues all Honcho calls same-origin to /api; nginx forwards each to the
# URL named in the per-request X-Honcho-Upstream header (no browser CORS). Seed the
# first instance with OPENCONCHO_DEFAULT_HONCHO_URL:
#
# To fold this into an existing Honcho Compose stack, drop the `openconcho`
# service into that project, set OPENCONCHO_DEFAULT_HONCHO_URL to the api service
# (e.g. http://api:8000 — nginx resolves it on the compose network), and add
# `depends_on: { api: { condition: service_healthy } }`.
# OPENCONCHO_DEFAULT_HONCHO_URL=https://honcho.example.net make compose-up
#
# To fold into an existing Honcho Compose stack, set OPENCONCHO_DEFAULT_HONCHO_URL
# to the api service (e.g. http://api:8000 — nginx resolves it on the compose
# network) and add `depends_on: { api: { condition: service_healthy } }`.
services:
openconcho:
image: ghcr.io/offendingcommit/openconcho-web:latest
# Or build from this repo instead of pulling the published image:
# build: .
build: .
image: openconcho-web:local
environment:
# The SPA seeds its first instance from this absolute URL; the browser then
# routes all calls same-origin through /api, and nginx forwards them to the
# URL named per-request in the X-Honcho-Upstream header (no browser CORS).
# Absolute URL seeding the first instance; the browser sends it as the
# X-Honcho-Upstream header and nginx forwards there (no browser CORS).
OPENCONCHO_DEFAULT_HONCHO_URL: ${OPENCONCHO_DEFAULT_HONCHO_URL:-http://host.docker.internal:8000}
# Optional SSRF guard. Unset = forward anywhere (safe for the localhost-only
# binding below). Set comma-separated host globs before exposing the proxy: