2025-11-17 12:55:18 -05:00
|
|
|
# Stage 1: Build the application
|
|
|
|
|
# Using Amazon ECR Public Gallery to avoid Docker Hub rate limits
|
|
|
|
|
FROM --platform=linux/arm64 public.ecr.aws/docker/library/maven:3.9-amazoncorretto-17 AS build
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Copy pom.xml and download dependencies (cached layer)
|
|
|
|
|
COPY pom.xml .
|
|
|
|
|
RUN mvn dependency:go-offline -B
|
|
|
|
|
|
|
|
|
|
# Copy source code and build
|
|
|
|
|
COPY src ./src
|
|
|
|
|
RUN mvn clean package -DskipTests
|
|
|
|
|
|
|
|
|
|
# Stage 2: Create the runtime image
|
|
|
|
|
# Using Amazon ECR Public Gallery to avoid Docker Hub rate limits
|
|
|
|
|
FROM --platform=linux/arm64 public.ecr.aws/amazoncorretto/amazoncorretto:17-al2023
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Copy the built JAR from the build stage
|
|
|
|
|
COPY --from=build /app/target/*.jar app.jar
|
|
|
|
|
|
|
|
|
|
# Amazon Bedrock AgentCore Runtime requires:
|
|
|
|
|
# - Host: 0.0.0.0
|
|
|
|
|
# - Port: 8080
|
|
|
|
|
# - Platform: ARM64
|
|
|
|
|
EXPOSE 8080
|
|
|
|
|
|
2026-05-20 18:35:16 -07:00
|
|
|
# Create non-root user and transfer ownership
|
|
|
|
|
RUN useradd -r -m -u 1001 appuser && chown -R appuser /app
|
|
|
|
|
USER appuser
|
|
|
|
|
|
2025-11-17 12:55:18 -05:00
|
|
|
# Run the application
|
|
|
|
|
ENTRYPOINT ["java", "-jar", "app.jar"]
|