feat: Configure VITE_API_URL during build via Gitea workflow and Dockerfile, removing local fallback. #3
@@ -45,7 +45,14 @@ jobs:
|
||||
# ---------- Frontend ----------
|
||||
- name: Build Frontend (${{ env.TAG }})
|
||||
run: |
|
||||
if [ "$TAG" = "dev" ]; then
|
||||
API_URL="http://t610:5005/api"
|
||||
else
|
||||
API_URL="http://t610:5004/api"
|
||||
fi
|
||||
|
||||
docker build \
|
||||
--build-arg VITE_API_URL=$API_URL \
|
||||
-t $REGISTRY/hospitality-frontend:${TAG} \
|
||||
-f src/hospitality-web/Dockerfile \
|
||||
src/hospitality-web
|
||||
|
||||
@@ -9,6 +9,9 @@ RUN npm ci
|
||||
# Kopier resten av koden
|
||||
COPY . .
|
||||
|
||||
ARG VITE_API_URL
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
|
||||
# Bygg for produksjon
|
||||
RUN npm run build
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from 'axios';
|
||||
import type { LoginRequest, LoginResponse, UserInfo } from '../types/auth';
|
||||
|
||||
const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:5163/api';
|
||||
const API_BASE_URL = import.meta.env.VITE_API_URL;
|
||||
|
||||
export const api = axios.create({
|
||||
baseURL: API_BASE_URL,
|
||||
|
||||
Reference in New Issue
Block a user