forked from FlinkFood/FlinkFood
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.flink
More file actions
49 lines (36 loc) · 1.33 KB
/
Copy pathDockerfile.flink
File metadata and controls
49 lines (36 loc) · 1.33 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
## BUILD STAGE
FROM eclipse-temurin:18-jdk AS build
RUN apt-get update && \
apt-get install -y maven wget && \
apt-get clean
# Set the working directory in the container
WORKDIR /opt/flink
# Download kafka binaries, so we can communicate with the kafka cluster
RUN wget https://archive.apache.org/dist/kafka/3.0.0/kafka_2.13-3.0.0.tgz && \
tar xzf kafka_2.13-3.0.0.tgz && \
rm kafka_2.13-3.0.0.tgz
# Add the Kafka command-line tools to the PATH
ENV PATH="/opt/flink/kafka_2.13-3.0.0/bin:${PATH}"
# Copy only the POM file to download dependencies
COPY flinkfood-demo/pom.xml .
COPY flinkfood-demo/CustomerViewJob/pom.xml .
COPY flinkfood-demo/RestaurantViewJob/pom.xml .
COPY flinkfood-demo/DishViewJob/pom.xml .
# Download dependencies
RUN mvn -B dependency:resolve-plugins dependency:resolve clean package
# Copy the rest of the project
COPY flinkfood-demo/ .
# Run Maven build and create necessary directories
RUN mvn clean package
# Copy the entry script to the build stage
COPY flink_start.sh /opt/flink/entry.sh
RUN chmod +x /opt/flink/entry.sh
## RUN STAGE
# Use a smaller base image for the runtime stage
FROM flink:latest
# Set the working directory in the container
WORKDIR /opt/flink
# Copy necessary files from the build stage
COPY --from=build /opt/flink /opt/flink
# Execute the entry script as the CMD
CMD ["/opt/flink/entry.sh"]