Files
ReadeckProxy/docker-compose.host-swift.yml

86 lines
2.5 KiB
YAML

# Hybrid development: Node builds the SPA in Docker; Swift compiles on the host (Linux ELF).
# The compiled App runs inside a slim Ubuntu container against Postgres in Compose.
#
# Prerequisite: same external network as docker-compose.yml
# ./scripts/create-docker-network.sh
#
# Build the Linux binary before `up`:
# Linux + Swift installed: swift build -c release --static-swift-stdlib --product App --build-path .build/linux-runner
# Otherwise: ./scripts/swift-build-linux-for-runner.sh
#
# Run:
# docker compose -f docker-compose.host-swift.yml up --build
networks:
readeck-proxy:
name: ${DOCKER_NETWORK:-readeck_proxy_net}
external: true
services:
client-build:
image: "${BASE_REGISTRY:-registry-group.kshaitry.com/library}/node:22-bookworm-slim"
working_dir: /app/client
volumes:
- .:/app
- client-node-modules-hostswift:/app/client/node_modules
command: sh -c "npm ci && npm run build"
networks:
- readeck-proxy
db:
build:
context: .
dockerfile: docker/db/Dockerfile
volumes:
- db_data_hostswift:/var/lib/postgresql
ports:
- "${POSTGRES_PORT}:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
networks:
- readeck-proxy
app:
build:
context: .
dockerfile: docker/app/Dockerfile.runner
args:
BASE_REGISTRY: ${BASE_REGISTRY:-registry-group.kshaitry.com/library}
volumes:
- .:/app
- ca-data-hostswift:/app/data/ca
ports:
- "${APP_PORT}:${APP_PORT}"
- "${PROXY_PORTS}:${PROXY_PORTS}"
depends_on:
db:
condition: service_healthy
client-build:
condition: service_completed_successfully
environment:
APP_PORT: ${APP_PORT}
APP_BINARY: ${HOST_SWIFT_APP_BINARY:-/app/.build/linux-runner/release/App}
DATABASE_HOST: db
# Inside Compose, Postgres listens on 5432 regardless of host port mapping (POSTGRES_PORT).
DATABASE_PORT: "5432"
DATABASE_USERNAME: ${POSTGRES_USER}
DATABASE_PASSWORD: ${POSTGRES_PASSWORD}
DATABASE_NAME: ${POSTGRES_DB}
CA_CERT_DIR: /app/data/ca
JWT_SECRET: ${JWT_SECRET:-dev-insecure-change-me}
working_dir: /app
networks:
- readeck-proxy
volumes:
db_data_hostswift:
ca-data-hostswift:
client-node-modules-hostswift: