- compose.cloud.yml: snipe-cloud project, proper Docker bridge network (api is internal-only, no host port), port 8514 for nginx - docker/web/Dockerfile: VITE_BASE_URL + VITE_API_BASE build args so Vite bakes the /snipe path prefix into the bundle at cloud build time - docker/web/nginx.cloud.conf: upstream api:8510 via Docker network (vs 172.17.0.1:8510 in dev which uses host networking) - manage.sh: cloud-start/stop/restart/status/logs/build commands - stores/search.ts: VITE_API_BASE prefix on all /api fetch calls Gate: Caddy basicauth (username: cf) — temporary gate while proper Heimdall license validation UI is built. Password stored at /devl/snipe-cloud-data/.beta-password (host-only, not in repo). Note: Caddyfile updated separately (caddy-proxy volume, not this repo).
22 lines
650 B
Docker
22 lines
650 B
Docker
# Stage 1: build
|
|
FROM node:20-alpine AS build
|
|
WORKDIR /app
|
|
COPY web/package*.json ./
|
|
RUN npm ci --prefer-offline
|
|
COPY web/ ./
|
|
|
|
# Build-time env vars — Vite bakes these as static strings into the bundle.
|
|
# VITE_BASE_URL: URL prefix the app is served under (/ for dev, /snipe for cloud)
|
|
# VITE_API_BASE: prefix for all /api/* fetch calls (empty for dev, /snipe for cloud)
|
|
ARG VITE_BASE_URL=/
|
|
ARG VITE_API_BASE=
|
|
ENV VITE_BASE_URL=$VITE_BASE_URL
|
|
ENV VITE_API_BASE=$VITE_API_BASE
|
|
|
|
RUN npm run build
|
|
|
|
# Stage 2: serve
|
|
FROM nginx:alpine
|
|
COPY docker/web/nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
EXPOSE 80
|