build: update Dockerfile to include 'contracts' and refine build context

Added `contracts/` directory to the Docker build context and adjusted Gradle setup to handle required dependencies. Simplified Dockerfile by removing redundant comments and streamlined artifact copying for NGINX configuration. Updated `.dockerignore` to exclude `docs/` directory from the build context.
This commit is contained in:
2026-01-31 12:32:38 +01:00
parent e699d7a198
commit 3d940ae4b1
2 changed files with 10 additions and 12 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
**/CHANGELOG* **/CHANGELOG*
**/LICENSE* **/LICENSE*
**/CONTRIBUTING* **/CONTRIBUTING*
# docs/ <- REMOVED: Required by Docker build context docs/
**/*.md **/*.md
# =================================================================== # ===================================================================
+9 -11
View File
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1.8 # syntax=docker/dockerfile:1.8
# =================================================================== # ===================================================================
# Multi-Stage Dockerfile for Meldestelle Web-App (Kotlin/JS) # Multi-Stage Dockerfile for Meldestelle Web-App (Kotlin/JS)
# Version: 2.1.0 - Fix: Use Debian for Build (Glibc), Alpine for Run # Version: 2.2.2 - Added 'contracts' to build context
# =================================================================== # ===================================================================
# === GLOBAL ARGS === # === GLOBAL ARGS ===
@@ -16,7 +16,6 @@ ARG BUILD_DATE
# =================================================================== # ===================================================================
# Stage 1: Build Stage (Debian-based for Node.js compatibility) # Stage 1: Build Stage (Debian-based for Node.js compatibility)
# =================================================================== # ===================================================================
# WICHTIG: Wir nutzen hier NICHT Alpine, damit die Node-Binaries funktionieren!
FROM gradle:${GRADLE_VERSION}-jdk${JAVA_VERSION} AS builder FROM gradle:${GRADLE_VERSION}-jdk${JAVA_VERSION} AS builder
ARG WEB_BUILD_PROFILE ARG WEB_BUILD_PROFILE
@@ -27,8 +26,6 @@ LABEL stage=builder
WORKDIR /workspace WORKDIR /workspace
# 1. Gradle Optimizations # 1. Gradle Optimizations
# Hinweis: Wir lassen Node/Yarn Download Flags weg, da Gradle auf Debian
# die Standard-Binaries problemlos laden und ausführen kann.
ENV GRADLE_OPTS="-Dorg.gradle.caching=true \ ENV GRADLE_OPTS="-Dorg.gradle.caching=true \
-Dorg.gradle.daemon=false \ -Dorg.gradle.daemon=false \
-Dorg.gradle.parallel=true \ -Dorg.gradle.parallel=true \
@@ -50,11 +47,14 @@ COPY platform/ platform/
COPY core/ core/ COPY core/ core/
COPY backend/ backend/ COPY backend/ backend/
COPY frontend/ frontend/ COPY frontend/ frontend/
# FIX: Docs Ordner ist notwendig für die Gradle-Konfigurationsphase COPY config/ config/
COPY docs/ docs/ # FIX: 'contracts' is required by Gradle during configuration phase
COPY contracts/ contracts/
# FIX: Create dummy docs dir to satisfy Gradle configuration phase
RUN mkdir -p docs
# 4. Resolve Dependencies # 4. Resolve Dependencies
# Wir lassen Gradle Node.js selbst herunterladen (funktioniert jetzt, da wir auf Debian sind)
RUN --mount=type=cache,target=/home/gradle/.gradle/caches \ RUN --mount=type=cache,target=/home/gradle/.gradle/caches \
--mount=type=cache,target=/home/gradle/.gradle/wrapper \ --mount=type=cache,target=/home/gradle/.gradle/wrapper \
./gradlew :frontend:shells:meldestelle-portal:dependencies --no-daemon ./gradlew :frontend:shells:meldestelle-portal:dependencies --no-daemon
@@ -92,13 +92,11 @@ LABEL service="web-app" \
# Tools & User Setup # Tools & User Setup
RUN apk add --no-cache curl && \ RUN apk add --no-cache curl && \
rm /etc/nginx/conf.d/default.conf && \ rm /etc/nginx/conf.d/default.conf
mkdir -p /usr/share/nginx/html/downloads
# Copy Artifacts # Copy Artifacts
COPY nginx.conf /etc/nginx/nginx.conf COPY --from=builder /workspace/config/docker/nginx/web-app/nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/dist/ /usr/share/nginx/html/ COPY --from=builder /app/dist/ /usr/share/nginx/html/
COPY downloads/ /usr/share/nginx/html/downloads/
# Permissions # Permissions
RUN chown -R nginx:nginx /usr/share/nginx/html && \ RUN chown -R nginx:nginx /usr/share/nginx/html && \