fix: use standalone nginx config without backend upstream in standalone mode

Nginx fails to start when the 'backend' upstream doesn't exist.
Standalone build now copies a minimal nginx config that only serves the SPA.
This commit is contained in:
Pouzor
2026-03-09 14:09:40 +01:00
parent 7ba5e888b4
commit 7dbd625ff2
2 changed files with 18 additions and 1 deletions
+7 -1
View File
@@ -16,7 +16,13 @@ FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html COPY --from=builder /app/dist /usr/share/nginx/html
# Nginx config: proxy /api and /ws to backend, serve SPA # Nginx config: use standalone config (no backend proxy) or full config
ARG VITE_STANDALONE=false
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY docker/nginx.standalone.conf /etc/nginx/conf.d/nginx.standalone.conf
RUN if [ "$VITE_STANDALONE" = "true" ]; then \
cp /etc/nginx/conf.d/nginx.standalone.conf /etc/nginx/conf.d/default.conf; \
fi && \
rm /etc/nginx/conf.d/nginx.standalone.conf
EXPOSE 80 EXPOSE 80
+11
View File
@@ -0,0 +1,11 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# SPA fallback — no backend proxy
location / {
try_files $uri $uri/ /index.html;
}
}