Initial commit: Scala/Thorium task manager demo app
This commit is contained in:
39
Dockerfile
Normal file
39
Dockerfile
Normal file
@@ -0,0 +1,39 @@
|
||||
# === Build stage ===
|
||||
FROM eclipse-temurin:17 AS build
|
||||
|
||||
# Install sbt
|
||||
RUN apt-get update && apt-get install -y curl gnupg && \
|
||||
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" > /etc/apt/sources.list.d/sbt.list && \
|
||||
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add && \
|
||||
apt-get update && apt-get install -y sbt && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Cache dependency resolution
|
||||
COPY build.sbt .
|
||||
COPY project/build.properties project/
|
||||
COPY project/plugins.sbt project/
|
||||
RUN sbt update
|
||||
|
||||
# Copy source and build fat JAR
|
||||
COPY src/ src/
|
||||
RUN sbt assembly
|
||||
|
||||
# === Runtime stage ===
|
||||
FROM eclipse-temurin:17-jre-alpine
|
||||
|
||||
RUN addgroup -S app && adduser -S app -G app
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/target/scala-3.7.1/demoapp.jar ./demoapp.jar
|
||||
|
||||
RUN chown -R app:app /app
|
||||
USER app
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENV PORT=8080
|
||||
ENV JAVA_OPTS="-XX:MaxRAMPercentage=75.0 -XX:+UseSerialGC"
|
||||
|
||||
ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar demoapp.jar"]
|
||||
Reference in New Issue
Block a user