lsport 0.3.10

A TUI for managing local and remote ports via SSH
FROM rust:1.88-bookworm

RUN apt-get update && apt-get install -y \
    debhelper \
    debhelper-compat \
    devscripts \
    dput \
    gnupg \
    libssl-dev \
    libssh2-1-dev \
    zlib1g-dev \
    pkg-config \
    lintian \
    make \
    git \
    ca-certificates \
    perl \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /workspace

# Copy project files
COPY . .

# Test offline Debian build (simulates Debian buildd environment)
# Step 1: Vendor dependencies (this is done in release workflow before creating orig.tar.gz)
# Step 2: Build with network disabled (simulates Debian buildd)
CMD ["bash", "-c", "\
    echo '=== Testing Debian Offline Build ===' && \
    echo '' && \
    echo '1. Vendoring dependencies (simulates release workflow)...' && \
    cargo vendor vendor && \
    mkdir -p .cargo && \
    echo '[source.crates-io]' > .cargo/config.toml && \
    echo 'replace-with = \"vendored-sources\"' >> .cargo/config.toml && \
    echo '[source.vendored-sources]' >> .cargo/config.toml && \
    echo 'directory = \"vendor\"' >> .cargo/config.toml && \
    rm -rf vendor/winapi-i686-pc-windows-gnu/lib/*.a vendor/winapi-x86_64-pc-windows-gnu/lib/*.a && \
    rm -rf vendor/*/docs/ && \
    for f in vendor/*/.cargo-checksum.json; do sed -i 's/\"files\":{[^}]*}/\"files\":{}/g' \"$f\" 2>/dev/null || true; done && \
    echo \"✅ Vendored $(ls -d vendor/*/ | wc -l) crates\" && \
    echo '' && \
    echo '2. Building with OFFLINE mode (simulates Debian buildd)...' && \
    export CARGO_NET_OFFLINE=true && \
    export OPENSSL_NO_VENDOR=1 && \
    make -f debian/rules clean && \
    make -f debian/rules build && \
    echo '' && \
    echo '3. Verifying build...' && \
    if ls target/release/lsport 2>/dev/null; then \
        echo '✅ Binary built successfully at target/release/lsport'; \
        ./target/release/lsport --version; \
    else \
        echo '❌ Binary not found!'; \
        exit 1; \
    fi && \
    echo '' && \
    echo '=== ✅ Offline Debian build test PASSED ===' \
"]