API URL was not taken from environment after docker container and npm was build
CORS prevented from loading
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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."
|
||||
Reference in New Issue
Block a user