-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (40 loc) · 1.62 KB
/
Dockerfile
File metadata and controls
56 lines (40 loc) · 1.62 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
55
56
ARG spark_image_tag=4.0.0-scala2.13-java17-python3-ubuntu
ARG scala_version
FROM sbtscala/scala-sbt:eclipse-temurin-alpine-17.0.15_6_1.11.3_2.13.16 AS builder
ARG scala_version
# Set the working directory
WORKDIR /app
# Copy the SBT configuration file
COPY build.sbt ./
# Copy the SBT project configuration directory
COPY project ./project
# Copy the application source code
COPY src ./src
# Compile the project with Scala
ENV SCALA_VERSION_LONG=${scala_version}.8
RUN sbt ++${SCALA_VERSION_LONG} package
# Build the spark image container sparkMeasure
FROM docker.io/library/spark:${spark_image_tag}
ARG scala_version
USER root
# Setup for the Prometheus JMX exporter.
# Add the Prometheus JMX exporter Java agent jar for exposing metrics sent to the JmxSink to Prometheus.
ENV JMX_EXPORTER_AGENT_VERSION=1.1.0
ADD https://github.com/prometheus/jmx_exporter/releases/download/${JMX_EXPORTER_AGENT_VERSION}/jmx_prometheus_javaagent-${JMX_EXPORTER_AGENT_VERSION}.jar /opt/spark/jars
RUN chmod 644 /opt/spark/jars/jmx_prometheus_javaagent-${JMX_EXPORTER_AGENT_VERSION}.jar
# Add the local sparkMeasure python code to the image
ADD python /opt/src/python
# Install the local sparkMeasure python package
RUN pip install /opt/src/python
# Add rootfs filesystem, it contains python scripts for runnning end-to-end tests
ADD e2e/rootfs/ /
# Copy the sparkMeasure compiled jar from the build stage
COPY --from=builder /app/target/scala-${scala_version}/*.jar /opt/spark/jars/
# Set the Spark user
ARG spark_uid=185
ENV spark_uid=${spark_uid}
USER ${spark_uid}
# Expose port 4040 for the Spark UI
EXPOSE 4040
# Set the default entrypoint
CMD ["/bin/bash"]