fix:
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
# ===================================================================
|
||||
# Multi-Stage Dockerfile für Meldestelle Web-App (Kotlin/JS)
|
||||
# ===================================================================
|
||||
|
||||
# ===================================================================
|
||||
# Stage 1: Build Stage - Kotlin/JS kompilieren
|
||||
# ===================================================================
|
||||
# Build args (build-time only)
|
||||
ARG GRADLE_VERSION
|
||||
ARG JAVA_VERSION
|
||||
ARG NODE_VERSION
|
||||
ARG NGINX_IMAGE_TAG=1.28.0-alpine
|
||||
# Toggle build profile: dev (default) or prod
|
||||
ARG WEB_BUILD_PROFILE=dev
|
||||
FROM gradle:${GRADLE_VERSION}-jdk${JAVA_VERSION} AS builder
|
||||
|
||||
# Install Node.js (version aligned with versions.toml)
|
||||
# Derive major version from NODE_VERSION (e.g., 22.21.0 -> setup_22.x)
|
||||
RUN apt-get update && apt-get install -y curl && \
|
||||
NODE_MAJOR=$(echo "$NODE_VERSION" | cut -d. -f1) && \
|
||||
curl -fsSL "https://deb.nodesource.com/setup_${NODE_MAJOR}.x" | bash - && \
|
||||
apt-get install -y nodejs && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Kopiere Gradle-Konfiguration und Wrapper
|
||||
COPY build.gradle.kts settings.gradle.kts gradle.properties ./
|
||||
COPY gradle ./gradle
|
||||
COPY gradlew ./
|
||||
|
||||
# Kopiere alle notwendigen Module für Multi-Modul-Projekt
|
||||
COPY frontend ./frontend
|
||||
COPY backend ./backend
|
||||
COPY core ./core
|
||||
COPY domains ./domains
|
||||
COPY platform ./platform
|
||||
COPY docs ./docs
|
||||
|
||||
# Setze Gradle-Wrapper Berechtigung
|
||||
RUN chmod +x ./gradlew
|
||||
|
||||
# Dependencies downloaden (für besseres Caching)
|
||||
RUN ./gradlew :frontend:shells:meldestelle-portal:dependencies --no-configure-on-demand
|
||||
|
||||
# Kotlin/JS Web-App kompilieren (Profil wählbar über WEB_BUILD_PROFILE)
|
||||
# - dev → jsBrowserDevelopmentExecutable (schneller, Source Maps)
|
||||
# - prod → jsBrowserDistribution (minifiziert, optimiert)
|
||||
RUN if [ "$WEB_BUILD_PROFILE" = "prod" ]; then \
|
||||
./gradlew :frontend:shells:meldestelle-portal:jsBrowserDistribution --no-configure-on-demand -Pproduction=true; \
|
||||
mkdir -p /app/web-dist && cp -r frontend/shells/meldestelle-portal/build/dist/js/productionExecutable/* /app/web-dist/; \
|
||||
else \
|
||||
./gradlew :frontend:shells:meldestelle-portal:jsBrowserDevelopmentExecutable --no-configure-on-demand; \
|
||||
mkdir -p /app/web-dist && cp -r frontend/shells/meldestelle-portal/build/dist/js/developmentExecutable/* /app/web-dist/; \
|
||||
fi
|
||||
|
||||
# ===================================================================
|
||||
# Stage 2: Runtime Stage - Nginx für Static Files + API Proxy
|
||||
# ===================================================================
|
||||
# Build arg controls runtime base image tag (declared globally to allow usage in FROM)
|
||||
FROM nginx:${NGINX_IMAGE_TAG}
|
||||
|
||||
# Installiere curl für Health-Checks
|
||||
RUN apk add --no-cache curl
|
||||
|
||||
# Kopiere kompilierte Web-App von Build-Stage (vereinheitlichtes Ausgabeverzeichnis)
|
||||
COPY --from=builder /app/web-dist/ /usr/share/nginx/html/
|
||||
|
||||
# Kopiere Nginx-Konfiguration
|
||||
COPY dockerfiles/clients/web-app/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Exponiere Port 4000 (statt Standard 80)
|
||||
EXPOSE 4000
|
||||
|
||||
# Downloads (Platzhalter) ausliefern lassen
|
||||
COPY dockerfiles/clients/web-app/downloads/ /usr/share/nginx/html/downloads/
|
||||
|
||||
# Health-Check für Container
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
||||
CMD curl -f http://localhost:4000/ || exit 1
|
||||
|
||||
# Starte Nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -0,0 +1,30 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Meldestelle – Desktop Downloads (Platzhalter)</title>
|
||||
<style>
|
||||
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif; margin: 2rem; }
|
||||
h1 { margin-bottom: .25rem; }
|
||||
.muted { color: #666; }
|
||||
ul { line-height: 1.8; }
|
||||
.card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 1rem 1.25rem; max-width: 720px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Desktop Downloads</h1>
|
||||
<p class="muted">Platzhalter-Verzeichnis. Hier können zukünftig Installer/Archive der Desktop-App bereitgestellt werden.</p>
|
||||
<div class="card">
|
||||
<p>Lege deine Dateien in dieses Verzeichnis im Repository:</p>
|
||||
<pre><code>dockerfiles/clients/web-app/downloads/</code></pre>
|
||||
<p>Oder mounte in Docker Compose ein Host-Verzeichnis auf <code>/usr/share/nginx/html/downloads</code>.</p>
|
||||
<p>Beispiele (geplant):</p>
|
||||
<ul>
|
||||
<li>Meldestelle-Setup-1.0.0.msi (Windows)</li>
|
||||
<li>Meldestelle-1.0.0.dmg (macOS)</li>
|
||||
<li>Meldestelle-1.0.0.deb (Linux)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,101 @@
|
||||
# ===================================================================
|
||||
# Nginx-Konfiguration für Meldestelle Web-App
|
||||
# Static Files + API Proxy zu Gateway
|
||||
# ===================================================================
|
||||
|
||||
# Worker-Prozesse (konfigurierbar über NGINX_WORKER_PROCESSES)
|
||||
worker_processes auto;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
use epoll;
|
||||
multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Logging
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
# Performance Optimizations
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
# Gzip Kompression für bessere Performance
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_min_length 1024;
|
||||
gzip_comp_level 6;
|
||||
gzip_types
|
||||
text/plain
|
||||
text/css
|
||||
text/xml
|
||||
text/javascript
|
||||
application/javascript
|
||||
application/xml+rss
|
||||
application/json
|
||||
application/wasm;
|
||||
|
||||
# Upstream für API Gateway
|
||||
upstream api-gateway {
|
||||
server api-gateway:8081;
|
||||
}
|
||||
|
||||
# Server-Block für Web-App
|
||||
server {
|
||||
listen 4000;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Serve static files (Kotlin/JS compiled files)
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
# Cache-Headers für statische Assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# WASM Files mit korrektem MIME-Type
|
||||
location ~* \.wasm$ {
|
||||
add_header Content-Type application/wasm;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
|
||||
# Proxy API calls zu Gateway
|
||||
location /api/ {
|
||||
proxy_pass http://api-gateway;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# CORS Headers für API-Calls
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
|
||||
add_header Access-Control-Allow-Headers "Content-Type, Authorization";
|
||||
|
||||
# Handle preflight requests
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
# Health-Check Endpoint
|
||||
location /health {
|
||||
access_log off;
|
||||
return 200 "healthy\n";
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user