forked from delta-io/delta-sharing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (45 loc) · 2.69 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (45 loc) · 2.69 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
# Delta Sharing / OpenSharing server, built from the source in THIS repository.
#
# It deliberately does not clone upstream: the presigner fix is a commit here, so the
# image and the code that produced it cannot drift apart.
#
# Build: docker build -t databricks-opensharing:dev .
# Run: see README.md
# ── Stage 1: compile ─────────────────────────────────────────────────────────
FROM sbtscala/scala-sbt:eclipse-temurin-17_1.x AS builder
WORKDIR /build
# Dependency resolution is the slow half of this build and changes far less often than
# the source, so copy the build definition first and let the layer cache keep it.
COPY build.sbt version.sbt scalastyle-config.xml ./
COPY project ./project
RUN sbt -batch update || true
COPY . .
# `sbt server/universal:packageBin` emits a zip under server/target/universal/ whose name
# carries the version. Glob it rather than hard-coding, so a version bump needs no edit here.
RUN sbt --batch "server/universal:packageBin" && \
ZIPFILE="$(ls "$PWD"/server/target/universal/delta-sharing-server-*.zip | head -n1)" && \
test -n "$ZIPFILE" && \
mkdir -p /dist-staging && cd /dist-staging && \
jar xf "$ZIPFILE" && \
DIST_DIR="$(ls -d /dist-staging/delta-sharing-server-*/ | head -n1)" && \
mv "$DIST_DIR" /dist
# `jar` is used rather than `unzip`, which the sbtscala image does not ship.
# ── Stage 2: runtime ─────────────────────────────────────────────────────────
FROM eclipse-temurin:17-jre
WORKDIR /opt/delta-sharing-server
COPY --from=builder /dist .
# Two fixups, both load-bearing:
# 1. `jar xf` does not preserve POSIX exec bits, so the launcher arrives non-executable.
# 2. The launcher puts `<dist>/../conf` on the classpath, so Hadoop reads core-site.xml as
# a CLASSPATH RESOURCE from the distribution's conf/ — NOT from HADOOP_CONF_DIR.
# Symlinking it at /config lets one mounted /config supply both the server YAML
# (passed with --config) and core-site.xml.
RUN chmod +x bin/delta-sharing-server && \
ln -sf /config/core-site.xml conf/core-site.xml
# The presigner resolves credentials through the AWS default chain rather than the
# fs.s3a.* keys, so AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_REGION must be present
# in the process environment as well as in core-site.xml. Left unset on purpose — supply
# them at run time; baking credentials into an image layer would publish them.
EXPOSE 8080
ENTRYPOINT ["bin/delta-sharing-server"]
CMD ["--config", "/config/delta-sharing-server.yaml"]