-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (37 loc) · 1.44 KB
/
Dockerfile
File metadata and controls
54 lines (37 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Stage 1: Build the application
FROM sbtscala/scala-sbt:eclipse-temurin-jammy-11.0.17_8_1.9.3_2.13.11 AS builder
WORKDIR /app
# Copy build files
COPY build.sbt .
COPY project ./project
# Download dependencies (cached layer)
RUN sbt update
# Copy source code
COPY src ./src
# Build fat JAR
RUN sbt clean assembly
# Stage 2: Runtime image
FROM eclipse-temurin:11-jre
WORKDIR /app
# Install curl for health checks
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
# Create Flink lib directory for S3 plugin
RUN mkdir -p /opt/flink/lib
# Download Flink S3 Hadoop plugin
RUN curl -L https://repo1.maven.org/maven2/org/apache/flink/flink-s3-fs-hadoop/1.18.0/flink-s3-fs-hadoop-1.18.0.jar \
-o /opt/flink/lib/flink-s3-fs-hadoop-1.18.0.jar
# Copy the JAR from builder
COPY --from=builder /app/target/scala-2.13/hw3-graphrag-assembly-1.0.jar /app/graphrag.jar
# Copy configuration
COPY src/main/resources/application.conf /app/application.conf
COPY src/main/resources/logback.xml /app/logback.xml
# Create logs directory
RUN mkdir -p /app/logs
# Set FLINK_LIB_DIR so Flink can find the S3 plugin
ENV FLINK_LIB_DIR=/opt/flink/lib
# Default JVM options
ENV JAVA_OPTS="-Xmx2g -Xms512m"
# Expose API port
EXPOSE 8081
# Run the application with classpath pointing to Flink lib
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -cp /app/graphrag.jar:/opt/flink/lib/* -Dconfig.file=/app/application.conf -Dlogback.configurationFile=/app/logback.xml Main"]