API URL was not taken from environment after docker container and npm was build

CORS prevented from loading
This commit is contained in:
2026-01-01 14:02:38 +01:00
parent 8c7aa86181
commit 7eb44a7ae6
10 changed files with 3911 additions and 7 deletions
+10
View File
@@ -1,6 +1,16 @@
# =========== 1) Build stage ===========
FROM node:22-alpine AS build
# Accept build arguments for Vite environment variables
ARG VITE_API_URL
ARG VITE_BASE_URL
ARG VITE_API_PORT
# Set them as environment variables for the build process
ENV VITE_API_URL=$VITE_API_URL
ENV VITE_BASE_URL=$VITE_BASE_URL
ENV VITE_API_PORT=$VITE_API_PORT
WORKDIR /usr/src/app
# Copy package files
+6 -2
View File
@@ -24,13 +24,17 @@ services:
build:
context: ../frontend
dockerfile: ../docker/Dockerfile.frontend
args:
VITE_API_URL: ${API_URL:-https://bamort.trokan.de:8180}
VITE_BASE_URL: ${BASE_URL:-https://bamort.trokan.de}
VITE_API_PORT: ${API_PORT:-8180}
container_name: bamort-frontend
ports:
- "8181:80"
environment:
- NODE_ENV=production
- VITE_API_URL=${API_URL:-http://bamort.trokan.de:8180}
- VITE_BASE_URL=${BASE_URL:-http://bamort.trokan.de}
- VITE_API_URL=${API_URL:-https://bamort.trokan.de:8180}
- VITE_BASE_URL=${BASE_URL:-https://bamort.trokan.de}
- VITE_API_PORT=${API_PORT:-8180}
depends_on:
- backend
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -1,6 +1,6 @@
#!/bin/bash
echo "🚀 Starting Bamort Development Environment..."
echo "🚀 Starting Bamort Production Environment..."
# Prüfe ob Docker läuft
if ! docker info > /dev/null 2>&1; then
@@ -11,7 +11,7 @@ fi
# Gehe ins Docker-Verzeichnis
cd "$(dirname "$0")"
echo "📦 Building and starting development containers..."
echo "📦 Building and starting production containers..."
# Stoppe vorhandene Container
docker-compose -f docker-compose.yml down
@@ -19,4 +19,4 @@ docker-compose -f docker-compose.yml down
# Baue und starte die Container
docker-compose -f docker-compose.yml up --build -d
echo "✅ Development environment started."
echo "✅ Production environment started."