-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (45 loc) · 1.58 KB
/
Copy pathDockerfile
File metadata and controls
60 lines (45 loc) · 1.58 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
57
58
59
60
# syntax=docker.io/docker/dockerfile:1.7-labs@sha256:b99fecfe00268a8b556fad7d9c37ee25d716ae08a5d7320e6d51c4dd83246894
ARG HOME="/home/unitycatalog"
# Build stage, using Amazon Corretto jdk 17 on alpine with arm64 support
FROM amazoncorretto:17-alpine3.20-jdk@sha256:c045f0537bc890f9e61924f33f35e9667f696b4f372dad4a73861a9396b5d0b5 as base
# Dependencies are installed in $HOME/.cache by sbt
ARG HOME
ENV HOME=$HOME
WORKDIR $HOME
COPY --parents dev/ build/ project/ examples/ server/ api/ clients/ version.sbt build.sbt ./
RUN apk add --no-cache bash && ./build/sbt -info clean package
# Small runtime image
FROM alpine:3.20@sha256:a4f4213abb84c497377b8544c81b3564f313746700372ec4fe84653e4fb03805 as runtime
# Specific JAVA_HOME from Amazon Corretto
ARG JAVA_HOME="/usr/lib/jvm/default-jvm"
ARG USER="unitycatalog"
ARG HOME
# Copy Java from base
COPY --from=base $JAVA_HOME $JAVA_HOME
ENV HOME=$HOME \
JAVA_HOME=$JAVA_HOME \
PATH="${JAVA_HOME}/bin:${PATH}"
# Copy build artifacts from base stage
COPY --from=base --parents \
$HOME/examples/ \
$HOME/server/ \
$HOME/api/ \
$HOME/clients/ \
$HOME/target/ \
$HOME/.cache/ \
/
# Create a service user with read and execute permissions and write permissions of the ./etc directory
RUN <<EOF
apk add --no-cache bash
addgroup -S $USER
adduser -S -G $USER $USER
chmod -R 550 $HOME
mkdir -p $HOME/etc/
chmod -R 770 $HOME/etc/
chown -R $USER:$USER $HOME
EOF
USER $USER
# Copy remaining directories here for caching optimization
COPY --chown=$USER:$USER --parents bin/ etc/ $HOME/
WORKDIR $HOME
CMD ["./bin/start-uc-server"]