forked from russwyte/mechanoid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (23 loc) · 1.02 KB
/
Dockerfile
File metadata and controls
33 lines (23 loc) · 1.02 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
################################################################################
### Build Image
################################################################################
FROM eclipse-temurin:21 AS build-image
WORKDIR /app
# Install SBT
ENV SBT_VERSION=1.12.0
RUN curl -sSL "https://github.com/sbt/sbt/releases/download/v$SBT_VERSION/sbt-$SBT_VERSION.tgz" | gunzip | tar -x -C /usr/local \
&& ln -s /usr/local/sbt/bin/sbt /usr/local/bin/sbt
# Copy Source
COPY . /app/
# Build Jar
RUN sbt "examples/assembly"
################################################################################
### Final Image
################################################################################
FROM eclipse-temurin:21
# Create a non-root user
RUN groupadd -f --gid 1000 --system appuser && useradd -o -m --uid 1000 --system appuser --gid 1000
WORKDIR /home/appuser
COPY --chown=appuser:appuser --chmod=500 --from=build-image /app/examples/target/scala-3.7.4/app.jar /home/appuser/app.jar
USER appuser
CMD ["java", "-jar", "app.jar"]