This commit is contained in:
33
Dockerfile
33
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
|
||||
|
||||
Reference in New Issue
Block a user