The base image approach was reverted for notes and clock due to workspace complexity. The trading repo was still using the base image approach which is causing build failures. Reverting to the vendor approach which works reliably for the monorepo structure. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
44 lines
1.3 KiB
Docker
44 lines
1.3 KiB
Docker
# Build context: learning_ai_invt_trdg/ (monorepo root)
|
|
# --- Stage 1: Build ---
|
|
FROM node:20-alpine AS builder
|
|
|
|
RUN corepack enable && corepack prepare pnpm@10.6.5 --activate
|
|
|
|
WORKDIR /app
|
|
|
|
ARG BYTELYST_PACKAGE_SOURCE=vendor
|
|
ENV BYTELYST_PACKAGE_SOURCE=${BYTELYST_PACKAGE_SOURCE}
|
|
|
|
COPY .npmrc .pnpmfile.cjs pnpm-workspace.yaml pnpm-lock.yaml* ./
|
|
COPY package.json ./package.json
|
|
COPY web/package.json ./web/package.json
|
|
COPY vendor/ ./vendor/
|
|
|
|
RUN pnpm install --filter @bytelyst/trading-web
|
|
|
|
COPY web/ ./web/
|
|
COPY shared/ ./shared/
|
|
|
|
# Build-time env vars (baked into the static bundle)
|
|
ARG VITE_PRODUCT_ID=invttrdg
|
|
ARG VITE_PLATFORM_URL=https://api.bytelyst.com/platform/api
|
|
ARG VITE_TRADING_API_URL=https://api.bytelyst.com/invttrdg
|
|
|
|
ENV VITE_PRODUCT_ID=${VITE_PRODUCT_ID}
|
|
ENV VITE_PLATFORM_URL=${VITE_PLATFORM_URL}
|
|
ENV VITE_TRADING_API_URL=${VITE_TRADING_API_URL}
|
|
|
|
WORKDIR /app/web
|
|
RUN pnpm run build
|
|
|
|
# --- Stage 2: Serve ---
|
|
FROM nginx:alpine
|
|
|
|
COPY --from=builder /app/web/dist /usr/share/nginx/html
|
|
|
|
# SPA fallback: all routes serve index.html
|
|
RUN printf 'server {\n listen 3085;\n root /usr/share/nginx/html;\n index index.html;\n location / {\n try_files $uri $uri/ /index.html;\n }\n gzip on;\n gzip_types text/plain text/css application/javascript application/json;\n}\n' > /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 3085
|
|
CMD ["nginx", "-g", "daemon off;"]
|