Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
target/
.git/
.github/
.claude/
.vscode/
.idea/
plans/
tmp/
temp/
.macp-data/
.DS_Store
*.swp
*.swo
*~
CLAUDE.md
35 changes: 21 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN: "1.89.0"

jobs:
check:
Expand All @@ -18,7 +19,9 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Cache cargo registry and build
uses: actions/cache@v4
Expand Down Expand Up @@ -47,8 +50,9 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt

- name: Check formatting
Expand All @@ -63,8 +67,9 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: clippy

- name: Cache cargo registry and build
Expand Down Expand Up @@ -94,7 +99,9 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Cache cargo registry and build
uses: actions/cache@v4
Expand Down Expand Up @@ -125,7 +132,9 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Cache cargo registry and build
uses: actions/cache@v4
Expand Down Expand Up @@ -216,14 +225,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install cargo-audit
run: cargo install cargo-audit

- name: Run cargo audit
run: cargo audit
uses: rustsec/audit-check@v2.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}

coverage:
name: Coverage
Expand All @@ -234,7 +239,9 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Cache cargo registry and build
uses: actions/cache@v4
Expand All @@ -252,7 +259,7 @@ jobs:
sudo apt-get install -y protobuf-compiler

- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
run: cargo install cargo-tarpaulin --locked

- name: Generate coverage
run: cargo tarpaulin --all-targets --out xml
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build & Push Docker Image

on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
name: Build Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Stage 1: Build
FROM rust:1.89-bookworm AS builder

RUN apt-get update && apt-get install -y protobuf-compiler && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Cache dependencies: copy manifests first, build a dummy, then copy real source
COPY Cargo.toml Cargo.lock build.rs ./
COPY proto/ proto/
RUN mkdir -p src && echo "fn main() {}" > src/main.rs && \
mkdir -p src/bin && \
cargo build --release 2>/dev/null || true && \
rm -rf src

# Copy full source and build for real
COPY src/ src/
COPY tests/ tests/
RUN cargo build --release

# Stage 2: Minimal runtime image
FROM debian:bookworm-slim

RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*

RUN useradd --create-home --shell /bin/bash macp
USER macp
WORKDIR /home/macp

COPY --from=builder /app/target/release/macp-runtime /usr/local/bin/macp-runtime

ENV MACP_BIND_ADDR=0.0.0.0:50051
ENV MACP_ALLOW_INSECURE=1
ENV MACP_DATA_DIR=/home/macp/.macp-data

EXPOSE 50051

ENTRYPOINT ["macp-runtime"]
6 changes: 0 additions & 6 deletions railpack.json

This file was deleted.

2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.86.0"
channel = "1.89.0"
Loading