# Development Dockerfile
# Expects pre-built JAR at skillhub-app/target/*.jar
# Used by: make staging (local development workflow)
FROM eclipse-temurin:21-jre-alpine

RUN addgroup -S app && adduser -S app -G app
WORKDIR /app

# Copy pre-built JAR from local build (relative to server/ directory)
COPY ./skillhub-app/target/*.jar app.jar

RUN chown -R app:app /app
USER app

EXPOSE 8080
HEALTHCHECK --interval=10s --timeout=3s --start-period=60s --retries=12 \
  CMD wget -qO- http://localhost:8080/actuator/health || exit 1

ENTRYPOINT ["java", "-XX:MaxRAMPercentage=75.0", "-jar", "app.jar"]
