Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (33 loc) · 1.59 KB
/
Copy pathDockerfile
File metadata and controls
40 lines (33 loc) · 1.59 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
FROM maven:3.9.16-eclipse-temurin-21 AS build
COPY src /home/app/src
COPY pom.xml /home/app
RUN mvn -B -ntp -Dmaven.test.skip=true -f /home/app/pom.xml clean package
FROM apache/spark:4.3.0-java21-python3
USER root
# python3-venv for the reporting tools; pango/cairo/gdk-pixbuf and fonts for
# weasyprint (PDF output of report.py)
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-venv \
libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf-2.0-0 \
fonts-dejavu-core \
&& rm -rf /var/lib/apt/lists/*
# requirements copied on their own so editing the scripts does not invalidate
# the pip layer
COPY reporting/requirements-report.txt reporting/requirements-dashboard.txt /opt/spruce/reporting/
RUN python3 -m venv /opt/spruce/venv \
&& /opt/spruce/venv/bin/pip install --no-cache-dir \
-r /opt/spruce/reporting/requirements-report.txt \
-r /opt/spruce/reporting/requirements-dashboard.txt
# The spark user's home is /nonexistent, where DuckDB cannot install the
# extensions the reporting tools need to read from S3. Give it a writable
# home and install them at build time so no download is needed at runtime.
ENV HOME=/home/spark
RUN mkdir -p "$HOME" \
&& /opt/spruce/venv/bin/python -c "import duckdb; c = duckdb.connect(); c.execute('INSTALL httpfs'); c.execute('INSTALL aws')" \
&& chown -R spark:spark "$HOME"
COPY reporting /opt/spruce/reporting
COPY --from=build /home/app/target/spruce-*.jar /usr/local/lib/spruce.jar
COPY entrypoint.sh /opt/spruce/entrypoint.sh
USER spark
EXPOSE 8501
ENTRYPOINT ["/opt/spruce/entrypoint.sh"]