This commit is contained in:
Bastian Wagner 2025-04-26 18:36:33 +02:00
parent a5767a2c79
commit b965500129
5 changed files with 106 additions and 3 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
dist

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
# ---- Build Stage ----
FROM node:18 AS builder
# Arbeitsverzeichnis im Container
WORKDIR /app
# Package-Dateien kopieren und installieren
COPY package.json package-lock.json ./
RUN npm install
# Quellcode kopieren
COPY . .
# Angular Build (Produktionsmodus)
RUN npm run build -- --configuration production
# ---- Run Stage ----
FROM nginx:stable-alpine
# Angular-Output in Nginx kopieren
COPY --from=builder /app/dist/stellar-lines/browser /usr/share/nginx/html
# Optionale eigene Nginx-Konfiguration (wenn gewünscht)
# COPY nginx.conf /etc/nginx/nginx.conf
# Exponiere Port 80
EXPOSE 80
# Start-Befehl (wird automatisch vom Nginx-Image gesetzt)

View File

@ -44,12 +44,12 @@
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
"maximumError": "10MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "4kB",
"maximumError": "8kB"
"maximumWarning": "40kB",
"maximumError": "80kB"
}
],
"outputHashing": "all"

15
docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
version: '3.8'
services:
shattered_kingdom_client:
image: bastianwagner/stellar_lines_client:latest
pull_policy: always
container_name: stellar_lines_client
ports:
- "3900:80"
restart: always
#depends_on:
# keyvault_pro_api:
# condition: service_healthy

57
nginx.conf Normal file
View File

@ -0,0 +1,57 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80 default_server;
# server_name localhost;
root /usr/share/nginx/html;
index index.html;
location /api/ {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://shattered_kingdom_api:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
try_files $uri$args $uri$args/ /index.html;
}
# Caching für Assets (z.B. /assets/)
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg)$ {
root /usr/share/nginx/html;
access_log off;
add_header Cache-Control "public, max-age=31536000, immutable";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}