feat(web): Dockerize web app, wire to deployed backend
- Add web/Dockerfile (node:20 builder + nginx:alpine, port 3085) - Add web service to docker-compose.yml with VITE_ build args - Create web/.env and mobile/.env pointing to api.bytelyst.com - Backend port mapping: 4025:4018 (4018 reserved by actiontrail) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b2f037c77d
commit
f0a6ce09ff
@ -17,6 +17,25 @@ services:
|
||||
- platform_net
|
||||
restart: unless-stopped
|
||||
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: web/Dockerfile
|
||||
args:
|
||||
GITEA_NPM_TOKEN: ${GITEA_NPM_TOKEN}
|
||||
VITE_PRODUCT_ID: invttrdg
|
||||
VITE_PLATFORM_URL: https://api.bytelyst.com/platform/api
|
||||
VITE_TRADING_API_URL: https://api.bytelyst.com/invttrdg/api
|
||||
container_name: invttrdg-web
|
||||
ports:
|
||||
- '3085:3085'
|
||||
networks:
|
||||
- default
|
||||
- platform_net
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
networks:
|
||||
default: {}
|
||||
platform_net:
|
||||
|
||||
42
web/Dockerfile
Normal file
42
web/Dockerfile
Normal file
@ -0,0 +1,42 @@
|
||||
# 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 GITEA_NPM_TOKEN
|
||||
ENV GITEA_NPM_TOKEN=${GITEA_NPM_TOKEN}
|
||||
|
||||
COPY .npmrc pnpm-workspace.yaml pnpm-lock.yaml* ./
|
||||
COPY package.json ./package.json
|
||||
COPY web/package.json ./web/package.json
|
||||
|
||||
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/api
|
||||
|
||||
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;"]
|
||||
Loading…
Reference in New Issue
Block a user