-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
24 lines (22 loc) · 1.01 KB
/
Dockerfile
File metadata and controls
24 lines (22 loc) · 1.01 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
# syntax=docker/dockerfile:1
# StackRivet application image (FR-027). Multi-stage: build the Spring Boot jar, run it on a JRE.
# docker build -t stackrivet-app .
# docker run -p 8080:8080 --env-file .env -e SPRING_PROFILES_ACTIVE=aliyun stackrivet-app
# The dev dependency stack (MySQL/PostgreSQL/MinIO/Redis) is in docker-compose.yml.
# --- build stage ---
FROM maven:3.9-eclipse-temurin-21 AS build
WORKDIR /src
# Copy the reactor and build only the bootable module + its dependencies.
COPY . .
RUN mvn -B -ntp -pl stackrivet-app -am -DskipTests package
# --- runtime stage ---
FROM eclipse-temurin:21-jre
# Run as a non-root user (security baseline).
RUN groupadd -r stackrivet && useradd -r -g stackrivet -d /app stackrivet
WORKDIR /app
COPY --from=build /src/stackrivet-app/target/stackrivet-app.jar app.jar
USER stackrivet
EXPOSE 8080
# JAVA_OPTS for heap/GC tuning; SPRING_PROFILES_ACTIVE selects the datasource profile.
ENV JAVA_OPTS="" SPRING_PROFILES_ACTIVE=""
ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar app.jar"]