This commit is contained in:
33
Dockerfile
33
Dockerfile
@ -1,4 +1,4 @@
|
|||||||
# syntax=docker/dockerfile:1.7
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Build stage
|
# Build stage
|
||||||
@ -19,12 +19,12 @@ RUN pnpm install --frozen-lockfile
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# --- Build args (styr Vite) ---
|
# --- Build args (styr Vite) ---
|
||||||
# Backend-url (ex sätts i Drone secrets)
|
# Backend-url (kan sättas i Drone secrets)
|
||||||
ARG VITE_API_BASE_URL=http://localhost:8080
|
ARG VITE_API_BASE_URL=https://rubble.se/hemhub/api
|
||||||
# Base path för proxy under /hemhub/
|
# Base path för proxy under /hemhub/
|
||||||
ARG VITE_BASE_PATH=/
|
ARG VITE_BASE_PATH=/app
|
||||||
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
|
ENV VITE_API_BASE_URL=https://rubble.se/hemhub/api
|
||||||
ENV VITE_BASE_PATH=${VITE_BASE_PATH}
|
ENV VITE_BASE_PATH=/app
|
||||||
|
|
||||||
# Bygg (Vite läser env vid build)
|
# Bygg (Vite läser env vid build)
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
@ -35,25 +35,8 @@ RUN pnpm build
|
|||||||
############################
|
############################
|
||||||
FROM nginx:1.27-alpine AS runtime
|
FROM nginx:1.27-alpine AS runtime
|
||||||
|
|
||||||
# Minimal nginx-konfig med SPA-fallback
|
# Lägg in Nginx-konfig (SPA fallback)
|
||||||
RUN <<'NGINX' sh -lc 'cat >/etc/nginx/conf.d/default.conf'
|
COPY ./.docker/nginx.conf /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
|
|
||||||
|
|
||||||
# Statiska filer från builden
|
# Statiska filer från builden
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|||||||
Reference in New Issue
Block a user