cleanup-and-test #1
@@ -41,7 +41,7 @@ services:
|
|||||||
context: ./frontend
|
context: ./frontend
|
||||||
dockerfile: Dockerfile.prod
|
dockerfile: Dockerfile.prod
|
||||||
args:
|
args:
|
||||||
VITE_API_URL: ${VITE_API_URL:?VITE_API_URL required}
|
VITE_API_URL: ${VITE_API_URL:-}
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -15,20 +15,18 @@ ENV VITE_API_URL=${VITE_API_URL}
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Production stage
|
# Production stage
|
||||||
FROM nginx:alpine
|
FROM caddy:alpine
|
||||||
|
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
# Copy built assets
|
||||||
|
COPY --from=builder /app/dist /srv
|
||||||
|
|
||||||
# Handle client-side routing
|
# Caddyfile for SPA routing
|
||||||
RUN echo 'server { \
|
RUN echo ':8080 { \
|
||||||
listen 8080; \
|
root * /srv \
|
||||||
root /usr/share/nginx/html; \
|
file_server \
|
||||||
index index.html; \
|
try_files {path} /index.html \
|
||||||
location / { \
|
}' > /etc/caddy/Caddyfile
|
||||||
try_files $uri $uri/ /index.html; \
|
|
||||||
} \
|
|
||||||
}' > /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000';
|
// Use VITE_API_URL if set at build time, otherwise derive from current origin
|
||||||
|
const API_URL = import.meta.env.VITE_API_URL || `${window.location.origin}/api`;
|
||||||
|
|
||||||
export interface ParticipantAPI {
|
export interface ParticipantAPI {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user