forked from PaperMC/patch-roulette
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (27 loc) · 1.01 KB
/
Copy pathDockerfile
File metadata and controls
41 lines (27 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Stage 1: Build the SvelteKit frontend
FROM oven/bun:1-alpine AS frontend
WORKDIR /app/web
COPY web/package.json web/bun.lock ./
RUN bun install --frozen-lockfile
COPY web/ .
RUN bun run build
# Stage 2: Build the Spring Boot jar
FROM eclipse-temurin:21-jdk-alpine AS builder
WORKDIR /app
COPY gradlew gradlew.bat build.gradle.kts settings.gradle.kts gradle.properties ./
COPY gradle/ gradle/
RUN chmod +x gradlew
# Pre-fetch Gradle wrapper and dependencies before copying source (cache layer)
RUN ./gradlew --no-daemon dependencies 2>&1 || true
COPY src/ src/
COPY --from=frontend /app/web/build web/build
RUN ./gradlew bootJar --no-daemon -x test
# Stage 3: Production runtime
FROM azul/zulu-openjdk-alpine:21-jre
WORKDIR /app
RUN addgroup -S app && adduser -S app -G app
COPY --from=builder --chown=app:app /app/build/libs/*.jar app.jar
USER app
EXPOSE 8080 8081
VOLUME ["/app/config", "/app/db"]
ENTRYPOINT ["java", "-jar", "app.jar", "--spring.config.additional-location=optional:file:/app/config/application.yaml"]