feat(deploy): Docker + Linux server deployment
Multi-stage Dockerfile (builder → export → runtime) producing a 149 MB Ubuntu 24.04 image, verified booting end-to-end on Docker Desktop. vcpkg fetched via shallow git fetch at the pinned baseline, release-only overlay triplets (x64-linux, arm64-linux) to halve intermediate disk usage, and buildtrees deleted within the RUN layer so they never land in the image or the BuildKit cache. Binary cache mount (VCPKG_BINARY_SOURCES) makes subsequent rebuilds restore pre-built packages instead of recompiling. Also adds: - docker-compose.yml for one-command local deploy - .dockerignore (excludes clients/, build/, .git/) - .github/workflows/build-linux.yml — CI cross-build for amd64 + arm64 with downloadable artifacts (primary path for building from Windows) - scripts/build-linux-binaries.sh — local Docker binary extraction fallback - deploy/linux/voicecat.service — hardened systemd unit for bare-metal - cmake/voicecat-toolchain.cmake now auto-wires VCPKG_OVERLAY_TRIPLETS Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
87
.github/workflows/build-linux.yml
vendored
Normal file
87
.github/workflows/build-linux.yml
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
name: Build Linux Binaries
|
||||
|
||||
# Builds stripped voicecat-server + voicecat-admin for linux/amd64 and linux/arm64.
|
||||
# Run manually from the Actions tab, or on any push to main.
|
||||
# Artifacts are downloadable from the workflow run for ~90 days.
|
||||
|
||||
on:
|
||||
workflow_dispatch: # manual trigger from the Actions tab
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'core/**'
|
||||
- 'server/**'
|
||||
- 'tools/**'
|
||||
- 'cmake/**'
|
||||
- 'CMakeLists.txt'
|
||||
- 'CMakePresets.json'
|
||||
- 'vcpkg.json'
|
||||
- 'Dockerfile'
|
||||
- '.github/workflows/build-linux.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: amd64
|
||||
runner: ubuntu-24.04
|
||||
vcpkg_triplet: x64-linux
|
||||
- arch: arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
vcpkg_triplet: arm64-linux
|
||||
|
||||
name: linux/${{ matrix.arch }}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Cache vcpkg packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/vcpkg
|
||||
/usr/local/share/vcpkg/buildtrees
|
||||
key: vcpkg-${{ matrix.vcpkg_triplet }}-${{ hashFiles('vcpkg.json') }}
|
||||
restore-keys: |
|
||||
vcpkg-${{ matrix.vcpkg_triplet }}-
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
build-essential cmake ninja-build git curl zip unzip tar \
|
||||
pkg-config autoconf autoconf-archive automake libtool nasm python3
|
||||
|
||||
- name: Set up vcpkg
|
||||
run: |
|
||||
VCPKG_COMMIT=$(jq -r '."builtin-baseline"' vcpkg.json)
|
||||
git init /tmp/vcpkg
|
||||
git -C /tmp/vcpkg remote add origin https://github.com/microsoft/vcpkg.git
|
||||
git -C /tmp/vcpkg fetch --depth=1 origin "$VCPKG_COMMIT"
|
||||
git -C /tmp/vcpkg checkout FETCH_HEAD
|
||||
/tmp/vcpkg/bootstrap-vcpkg.sh -disableMetrics
|
||||
echo "VCPKG_ROOT=/tmp/vcpkg" >> "$GITHUB_ENV"
|
||||
echo "VCPKG_DISABLE_METRICS=1" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build (server-release preset)
|
||||
run: |
|
||||
cmake --preset server-release
|
||||
cmake --build --preset server-release
|
||||
|
||||
- name: Collect binaries
|
||||
run: |
|
||||
mkdir -p dist
|
||||
cp build/server-release/bin/voicecat-server dist/
|
||||
cp build/server-release/bin/voicecat-admin dist/
|
||||
file dist/voicecat-server dist/voicecat-admin
|
||||
ls -lh dist/
|
||||
|
||||
- name: Upload binaries
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: voicecat-linux-${{ matrix.arch }}
|
||||
path: dist/
|
||||
retention-days: 90
|
||||
Reference in New Issue
Block a user