34 lines
851 B
Docker
34 lines
851 B
Docker
# 1. Frontend Build Stage
|
|
FROM node:20-alpine AS frontend-build
|
|
WORKDIR /app/frontend
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# 2. Backend & Serving Stage
|
|
FROM python:3.9-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies (if needed for TA-Lib or others)
|
|
# RUN apt-get update && apt-get install -y gcc ...
|
|
|
|
# Copy backend requirements
|
|
COPY ./backend/requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy backend code
|
|
COPY ./backend ./backend
|
|
|
|
# Copy frontend build artifacts to backend static folder
|
|
COPY --from=frontend-build /app/frontend/dist ./backend/static
|
|
|
|
# Environment variables
|
|
ENV PORT=80
|
|
EXPOSE 80
|
|
|
|
# Run FastAPI server
|
|
# Assuming main.py is in backend folder and app object is named 'app'
|
|
CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "80"] |