# Use the official OpenJDK base image with Java 17
FROM openjdk:17-jdk-slim

# Install Xvfb
RUN apt-get update && apt-get install -y \
    xvfb

# Set the working directory to /app
WORKDIR /app

# Copy the source code from your host to the container
COPY ./src /app

# Compile all Java source files
RUN javac *.java

# Start Xvfb and run the Java application
CMD ["sh", "-c", "Xvfb :1 -screen 0 1024x768x16 -ac & export DISPLAY=:1 && java -cp /app Search"]