# Use Ubuntu 22.04 as the base image (you can match this to what is used in rust.yml)
FROM ubuntu:22.04

# Install required dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    cmake \
    libssl-dev \
    pkg-config \
    && rm -rf /var/lib/apt/lists/*

# Install Rust using rustup
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Set the environment for rust commands
ENV PATH="/root/.cargo/bin:${PATH}"

# Optionally, you can install specific rust targets if specified in rust.yml
RUN rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu

# Set the working directory inside the container
WORKDIR /usr/src/myapp

# Copy your project files into the container
COPY . .

# Run the test commands as defined in rust.yml
CMD ["cargo", "test"]

