# User mode UAT testing for systemg
FROM rust:1.75 AS builder

WORKDIR /app
COPY . .
RUN cargo build --release

FROM ubuntu:22.04

# Install runtime requirements for user-mode tests
RUN apt-get update && apt-get install -y \
    nodejs \
    npm \
    python3 \
    && rm -rf /var/lib/apt/lists/*

# Copy local sysg binary built from the current workspace.
COPY --from=builder /app/target/release/sysg /usr/local/bin/
RUN chmod +x /usr/local/bin/sysg

# Create test user for user-mode testing
RUN useradd -m -s /bin/bash testuser
USER testuser
WORKDIR /home/testuser

# Copy test projects and scripts
COPY --chown=testuser:testuser tests/docker/user/ /home/testuser/

# Run the simplified test for now
CMD ["/bin/bash", "simple_test.sh"]
