-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.optimized
More file actions
67 lines (51 loc) · 2.91 KB
/
Copy pathDockerfile.optimized
File metadata and controls
67 lines (51 loc) · 2.91 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
61
62
63
64
65
66
67
################ Build ################
# Build stage for the full multi-module project
FROM maven:3.9.16-eclipse-temurin-25-alpine AS build
WORKDIR /workspace
# Copy Maven configuration files first for better layer caching
COPY pom.xml ./
COPY fluxcord-api/pom.xml ./fluxcord-api/
COPY fluxcord-core/pom.xml ./fluxcord-core/
COPY examples/plugins/plugin-example-audio/pom.xml ./examples/plugins/plugin-example-audio/
COPY examples/plugins/plugin-example-commands/pom.xml ./examples/plugins/plugin-example-commands/
COPY plugin-template/pom.xml ./plugin-template/
COPY plugins/music-plugin/pom.xml ./plugins/music-plugin/
COPY plugins/ai-audio-plugin/pom.xml ./plugins/ai-audio-plugin/
# Download dependencies first (this layer will be cached if pom.xml files don't change)
# Use offline mode to avoid network calls during build
RUN mvn dependency:go-offline -B -T1C
# Copy source code (this layer will be rebuilt only when source changes)
COPY . .
# Build all modules with optimizations
RUN mvn -T1C -DskipTests -Dmaven.test.skip=true -Dmaven.javadoc.skip=true package \
&& mkdir -p /workspace/.artifacts /workspace/.bundles/plugins /workspace/.bundles/examples \
&& cp -f /workspace/fluxcord-core/target/*-shaded.jar /workspace/.artifacts/fluxcord.jar \
&& (cp -f /workspace/plugins/*/target/*.jar /workspace/.bundles/plugins/ 2>/dev/null || true) \
&& (cp -f /workspace/examples/plugins/*/target/*.jar /workspace/.bundles/examples/ 2>/dev/null || true)
################ Production ################
# JDAVE (DAVE native lib) ships prebuilt natives for glibc only, and they need GLIBC >= 2.38.
# Ubuntu 24.04 "noble" (glibc 2.39 + recent libstdc++) runs JDAVE's bundled libdave.so as-is,
# so no native compilation is needed here. Do NOT use an Alpine/musl base: JDAVE has no musl build.
FROM eclipse-temurin:25.0.4_7-jre-noble AS production
ENV APP_DIR=/app \
BUNDLES_DIR=/opt/fluxcord/bundles \
JAVA_OPTS=""
WORKDIR /app
# Install curl for healthcheck
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
## Core shaded jar
COPY --from=build /workspace/.artifacts/fluxcord.jar /app/fluxcord.jar
# Bundle available plugins (internal plugins)
RUN mkdir -p /opt/fluxcord/bundles/plugins /opt/fluxcord/bundles/examples
# Copy bundled plugin jars (empty dir is fine)
COPY --from=build /workspace/.bundles/plugins/ /opt/fluxcord/bundles/plugins/
COPY --from=build /workspace/.bundles/examples/ /opt/fluxcord/bundles/examples/
# Entrypoint script to optionally install/update plugins before launch
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
VOLUME ["/app/data", "/app/plugins"]
ENTRYPOINT ["/entrypoint.sh"]
# Docker healthcheck (ready file created by core after full startup)
# Docker healthcheck: HTTP ready endpoint exposed by the core
ENV HEALTH_PORT=8081
HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD curl -fsS http://127.0.0.1:${HEALTH_PORT}/readyz || exit 1