30 lines
830 B
Docker
30 lines
830 B
Docker
|
|
# Dockerfile.ws — frontend build (STORAGE=ws) served by Caddy
|
||
|
|
# Same-origin: Caddy proxies /api + /ws to backend. No backend URL baked at build.
|
||
|
|
|
||
|
|
FROM node:18-alpine AS build
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# workspaces root
|
||
|
|
COPY package*.json ./
|
||
|
|
COPY shared/package.json ./shared/
|
||
|
|
COPY server/package.json ./server/
|
||
|
|
RUN npm install --include-workspace-root
|
||
|
|
|
||
|
|
COPY shared/ ./shared/
|
||
|
|
COPY src/ ./src/
|
||
|
|
COPY public/ ./public/
|
||
|
|
|
||
|
|
# Build with ws storage (no backend URL — same-origin via Caddy proxy)
|
||
|
|
ARG REACT_APP_TRACKER_APP_ID=ttrpg-initiative-tracker-default
|
||
|
|
ENV REACT_APP_STORAGE=ws
|
||
|
|
ENV REACT_APP_TRACKER_APP_ID=$REACT_APP_TRACKER_APP_ID
|
||
|
|
RUN NODE_OPTIONS=--openssl-legacy-provider npm run build
|
||
|
|
|
||
|
|
# Stage 2: Caddy serves static + proxies API/WS
|
||
|
|
FROM caddy:2-alpine
|
||
|
|
|
||
|
|
COPY --from=build /app/build /srv
|
||
|
|
COPY Caddyfile /etc/caddy/Caddyfile
|
||
|
|
|
||
|
|
EXPOSE 80
|