Files
holy-flavor-rater/frontend/Dockerfile
T
2026-07-26 17:42:44 +02:00

46 lines
1.4 KiB
Docker

# --- Build Stage ---
# Bun replaces npm for install + scripts. bun.lock is the lockfile of record
# (package-lock.json is gone); --frozen-lockfile fails the build loudly if it
# has drifted from package.json instead of quietly resolving something else.
FROM oven/bun:1.3-alpine AS build-stage
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
COPY . .
# Pass VITE environment variables during build
ARG VITE_API_URL
ARG VITE_IMPRESSUM_NAME
ARG VITE_IMPRESSUM_STREET
ARG VITE_IMPRESSUM_CITY
ARG VITE_IMPRESSUM_EMAIL
ARG VITE_IMPRESSUM_PHONE
ENV VITE_API_URL=${VITE_API_URL}
ENV VITE_IMPRESSUM_NAME=${VITE_IMPRESSUM_NAME}
ENV VITE_IMPRESSUM_STREET=${VITE_IMPRESSUM_STREET}
ENV VITE_IMPRESSUM_CITY=${VITE_IMPRESSUM_CITY}
ENV VITE_IMPRESSUM_EMAIL=${VITE_IMPRESSUM_EMAIL}
ENV VITE_IMPRESSUM_PHONE=${VITE_IMPRESSUM_PHONE}
RUN bun run build
# --- Production Stage ---
# nginx 1.30 is the current stable branch (identical to `stable-alpine` today),
# pinned so a rebuild can't silently roll onto the next branch.
FROM nginx:1.30-alpine
# Copy built files
COPY --from=build-stage /app/dist /usr/share/nginx/html
# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Nginx config: serves the SPA and proxies /api to the Rust backend.
# proxy_params.conf holds shared proxy headers.
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY proxy_params.conf /etc/nginx/proxy_params.conf
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]