# Use a small official JDK base image
FROM eclipse-temurin:21-jdk-jammy

# Install Python (and pip)
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 python3-pip \
 && rm -rf /var/lib/apt/lists/*

# Create a non-root user for security
RUN useradd -ms /bin/bash spring
USER spring

# Set working directory
WORKDIR /app

# Copy the JAR file into the image
COPY *.jar app.jar

# Expose the Spring Boot port
EXPOSE 8080

# Run the Spring Boot app
ENTRYPOINT ["java", "-jar", "app.jar"]