refactor: reorganize project structure and fix broken references
- Move scripts to scripts/ directory (roda.sh, prepara_db.py, etc.) - Move shell config to shell/ directory (Caddyfile, auth.py, haloy.yml) - Move basedosdados.duckdb to data/ directory - Update Dockerfile and start.sh with new file paths - Update README.md with correct script paths - Remove Python ask.py (replaced by Rust binary in ask/ask) - Add Rust source files (schema_filter.rs, sql_generator.rs, table_selector.rs) - Remove sentence-transformer dependencies from ask - Move docs and context artifacts to their directories
This commit is contained in:
42
scripts/build_ask.sh
Executable file
42
scripts/build_ask.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
echo "=== Building ask binary for Linux x86_64 ==="
|
||||
echo "Using Debian x86_64 container for native build..."
|
||||
|
||||
# Build in an x86_64 Debian container - this gives us a real x86_64 environment
|
||||
# so we can build natively without cross-compilation complexity
|
||||
# Use ask/ as context to avoid .dockerignore excluding src/
|
||||
docker build \
|
||||
--platform linux/amd64 \
|
||||
-t ask-builder \
|
||||
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
||||
-f - ask/ <<'EOF'
|
||||
FROM rust:1.85-slim
|
||||
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential pkg-config libssl-dev && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY . ./
|
||||
RUN cargo build --release --locked
|
||||
|
||||
FROM scratch
|
||||
COPY --from=0 /build/target/release/ask /ask
|
||||
EOF
|
||||
|
||||
echo "=== Extracting binary ==="
|
||||
# Extract the binary from the container
|
||||
docker run --rm --platform linux/amd64 ask-builder cat /ask > ./ask/target/release/ask
|
||||
|
||||
# Make it executable
|
||||
chmod +x ./ask/target/release/ask
|
||||
|
||||
echo "=== Binary built successfully ==="
|
||||
file ./ask/target/release/ask
|
||||
ls -lh ./ask/target/release/ask
|
||||
Reference in New Issue
Block a user