Single part at the root, COMPOSE_FILE in .env

This commit is contained in:
hh
2026-09-08 20:38:27 +02:00
parent ade2cebf63
commit ecd38ee28b
31 changed files with 70 additions and 28 deletions
@@ -4,7 +4,7 @@
{
"hooks": [
{
"command": "cd frontend && bun run fix --skip=correctness/noUnusedImports",
"command": "{% if layout == 'part' %}cd frontend && {% endif %}bun run fix --skip=correctness/noUnusedImports",
"type": "command"
}
],
-1
View File
@@ -1 +0,0 @@
PUBLIC_API_BASE_URL=/api
-17
View File
@@ -1,17 +0,0 @@
COMPOSE := docker compose --project-directory ..
.PHONY: fmt check build dev
fmt:
bun run fix
check:
bun run check
bun run lint
build:
{% if serve == 'api' %} $(COMPOSE) run --rm frontend-dev sh -c "bun install && bun run build"
{% else %} $(COMPOSE) build frontend
{% endif %}
dev:
bun run dev
@@ -0,0 +1,2 @@
{% if layout == 'root' %}COMPOSE_FILE=docker-compose.yml:docker-compose.local.yml
{% endif %}PUBLIC_API_BASE_URL=/api
+40
View File
@@ -0,0 +1,40 @@
COMPOSE := docker compose{% if layout == 'part' %} --project-directory ..{% endif %}
{% if layout == 'root' %}SERVICES := $(COMPOSE) --profile services
EXTERNAL := $(COMPOSE) --profile external
{% endif %}
.PHONY: {% if layout == 'root' %}env external recreate rebuild restart logs down {% endif %}fmt check build dev
fmt:
bun run fix
check:
bun run check
bun run lint
build:
{% if serve == 'api' %} $(COMPOSE) run --rm frontend-dev sh -c "bun install && bun run build"
{% else %} $(COMPOSE) build frontend
{% endif %}
dev:
bun run dev
{% if layout == 'root' %}
env:
@test -f .env || cp .env.example .env
external:
$(EXTERNAL) up -d
recreate: external
$(SERVICES) up -d --force-recreate
rebuild: build recreate
restart:
$(SERVICES) restart
logs:
$(SERVICES) logs -f --tail=100
down:
$(EXTERNAL) --profile services down
{% endif %}
@@ -1,15 +1,15 @@
services:
{% if serve != 'api' %} frontend:
build: frontend
build: {{ part_dir }}
image: {{ project_slug }}/frontend
profiles: [frontend, services]
restart: unless-stopped
env_file:
- path: .env
required: false
- path: frontend/.env
{% if layout == 'part' %} - path: frontend/.env
required: false
command: {% if serve == 'bun' %}[build/index.js]{% else %}[run, serve.ts]{% endif %}
{% endif %} command: {% if serve == 'bun' %}[build/index.js]{% else %}[run, serve.ts]{% endif %}
{% endif %} frontend-dev:
image: oven/bun:alpine
@@ -19,12 +19,12 @@ services:
env_file:
- path: .env
required: false
- path: frontend/.env
{% if layout == 'part' %} - path: frontend/.env
required: false
environment:
{% endif %} environment:
API_PROXY_TARGET: http://api:8080
volumes:
- ./frontend:/app
- {{ './frontend' if layout == 'part' else '.' }}:/app
- frontend_node_modules:/app/node_modules
- frontend_svelte_kit:/app/.svelte-kit
command: [sh, -c, "bun install && bun run dev --host 0.0.0.0 --port 3000"]