#!/usr/bin/env bash # compile-backend.sh — build the Linux backend binary + shared-infra # configs.tar.gz into dist/. Server pipeline (server-v*). Does NOT touch # version.yaml (that is client-owned) nor any Flutter/web artifact. set -euo pipefail # shellcheck source=scripts/ci/_env.sh . "$(dirname "$0")/_env.sh" TAG="$1" echo "==> compile-backend: tag=${TAG}" # Build Go backend (linux/amd64 for EC2) cd backend GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o jiu-server . # Platform code-minting CLI (gencode) ships alongside the server so codes can be # minted on EC2 without cross-compiling/scp each time. GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o jiu-gencode ./cmd/gencode cd .. mkdir -p dist mv backend/jiu-server dist/jiu-server mv backend/jiu-gencode dist/jiu-gencode # Shared infrastructure (nginx/systemd/env/compose). version.yaml is NOT here — # it belongs to the client pipeline. tar -czf dist/configs.tar.gz \ deploy/nginx-jiu.conf \ deploy/nginx-jiu-ali.conf \ deploy/jiu.service \ deploy/production.env.template \ deploy/setup-ec2.sh \ deploy/docker-compose.yml \ deploy/docker-compose.jiu.yml \ deploy/jiu-gencode.sh echo "==> compile-backend: done — dist/ contents:" ls -lh dist/