Files
Botinator/Dockerfile
T
ksan cbefb7b21f
CI/CD / build (push) Successful in 2m17s
CI/CD / deploy (push) Failing after 10s
added ci/cd
2026-07-10 00:13:57 +02:00

32 lines
1.1 KiB
Docker

# syntax=docker/dockerfile:1
# ---- Build stage: compile and assemble a runnable distribution ----
FROM eclipse-temurin:25-jdk AS build
WORKDIR /app
# Copy the Gradle wrapper and build scripts first so dependency resolution is
# cached in its own layer and only re-runs when the build files change.
COPY gradlew settings.gradle.kts build.gradle.kts ./
COPY gradle ./gradle
RUN chmod +x gradlew && ./gradlew --no-daemon dependencies > /dev/null 2>&1 || true
# Now the source. `installDist` produces build/install/Botinator with a launcher
# script and all dependency jars under lib/.
COPY src ./src
RUN ./gradlew --no-daemon --stacktrace installDist
# ---- Runtime stage: JRE only, no build tooling ----
FROM eclipse-temurin:25-jre
WORKDIR /app
# Run as an unprivileged user.
RUN useradd --system --create-home --uid 10001 botinator
USER botinator
# The assembled app (bin/Botinator launcher + lib/*.jar).
COPY --from=build --chown=botinator:botinator /app/build/install/Botinator/ ./
# BOT_TOKEN etc. and the catchphrases file are supplied at deploy time
# (env_file / -e for config, a mounted volume for catchphrases.txt).
ENTRYPOINT ["./bin/Botinator"]