Files
demo-monolith/Dockerfile
T
Liosha84andClaude Opus 5.5 fd51342a0c fix(docker): run on Java 26 to match the build toolchain
The app is compiled with toolchain 26 (class file 70), but the runtime
image was eclipse-temurin:21 (max class file 65), which caused
UnsupportedClassVersionError at startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 00:19:36 +02:00

37 lines
1.2 KiB
Docker

# 1. Этап сборки (Build stage)
FROM eclipse-temurin:26-jdk-jammy AS build
# Устанавливаем только Node.js v20 для Angular
RUN apt-get update && apt-get install -y curl \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Копируем всё содержимое проекта
COPY . .
# Даем права на запуск Gradle
RUN chmod +x gradlew
# Устанавливаем зависимости фронтенда
RUN cd spring-angular-ui && npm install --legacy-peer-deps
# Запускаем сборку через Gradle
RUN ./gradlew copyAngularBuild --no-daemon --info
RUN ./gradlew bootJar -x test --no-daemon
# 2. Финальный образ (Runtime stage)
FROM eclipse-temurin:26-jdk-jammy
# Здесь оставляем все утилиты управления контейнерами
RUN apt-get update && \
apt-get install -y docker.io docker-compose-v2 && \
apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /app/build/libs/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod", "app.jar"]