learning_ai_invt_trdg/web/Dockerfile
root a586d3e158 refactor(docker): use shared base images for @bytelyst/* packages
Update Dockerfiles to use bytelyst-common-base-backend and bytelyst-common-base-web
images instead of installing @bytelyst/* packages via vendor directory.

Benefits:
- Smaller final images (~50MB vs ~250MB)
- Faster builds (base image cached)
- Consistent package versions across products
- No need for vendor/ directory maintenance

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-05-10 00:27:17 +00:00

45 lines
1.5 KiB
Docker

# Build context: learning_ai_invt_trdg/ (monorepo root)
# --- Stage 1: Build ---
FROM bytelyst-common-base-web:latest AS builder
WORKDIR /app
# Copy workspace root files
COPY .npmrc pnpm-workspace.yaml pnpm-lock.yaml* ./
COPY package.json ./package.json
COPY web/package.json ./web/package.json
# Install all dependencies (including devDependencies for building)
RUN pnpm install --filter @bytelyst/trading-web --ignore-scripts
# Copy source
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
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost:3085 || exit 1
EXPOSE 3085
CMD ["nginx", "-g", "daemon off;"]