# Use a base image with a recent Linux distribution
FROM archlinux:latest

# Set up a non-root user for security best practices
RUN useradd -m builder
USER builder
WORKDIR /home/builder

# Install necessary dependencies
# Use sudo for pacman, then remove it for the builder user
RUN sudo pacman -Syu --noconfirm
RUN sudo pacman -S --noconfirm \
    base-devel \
    cmake \
    qt5-base \
    pipewire \
    glib2 \
    pkg-config \
    git

# Copy the project source code into the container
COPY . /home/builder/Hyperion_Grabber_X11_QT
WORKDIR /home/builder/Hyperion_Grabber_X11_QT

# Create a build directory and build the project
RUN mkdir build
WORKDIR build
RUN cmake ..
RUN make

# You can add commands here to run tests or package the application
# For now, we'll just ensure it builds successfully

# Command to run the wayland_poc executable (for testing inside the container)
# This will require a Wayland compositor running inside the container, which is complex.
# The primary goal here is to get it to compile.
CMD ["./wayland_poc"]
