From 0d15a5bc18991de0a22726d8507eb0bd002d1700 Mon Sep 17 00:00:00 2001 From: Urban Modig Date: Sun, 12 Oct 2025 21:15:41 +0200 Subject: [PATCH] Dockerfile --- Dockerfile | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index 66c0fd2..fb757da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.7 +# syntax=docker/dockerfile:1 ############################ # Build stage @@ -19,12 +19,12 @@ RUN pnpm install --frozen-lockfile COPY . . # --- Build args (styr Vite) --- -# Backend-url (ex sätts i Drone secrets) -ARG VITE_API_BASE_URL=http://localhost:8080 +# Backend-url (kan sättas i Drone secrets) +ARG VITE_API_BASE_URL=https://rubble.se/hemhub/api # Base path för proxy under /hemhub/ -ARG VITE_BASE_PATH=/ -ENV VITE_API_BASE_URL=${VITE_API_BASE_URL} -ENV VITE_BASE_PATH=${VITE_BASE_PATH} +ARG VITE_BASE_PATH=/app +ENV VITE_API_BASE_URL=https://rubble.se/hemhub/api +ENV VITE_BASE_PATH=/app # Bygg (Vite läser env vid build) RUN pnpm build @@ -35,25 +35,8 @@ RUN pnpm build ############################ FROM nginx:1.27-alpine AS runtime -# Minimal nginx-konfig med SPA-fallback -RUN <<'NGINX' sh -lc 'cat >/etc/nginx/conf.d/default.conf' -server { - listen 80; - server_name _; - - root /usr/share/nginx/html; - index index.html; - - # gzip statiska assets - gzip on; - gzip_types text/plain text/css application/javascript application/json image/svg+xml; - - # Single Page App fallback - location / { - try_files $uri /index.html; - } -} -NGINX +# Lägg in Nginx-konfig (SPA fallback) +COPY ./.docker/nginx.conf /etc/nginx/conf.d/default.conf # Statiska filer från builden COPY --from=build /app/dist /usr/share/nginx/html