27 lines
653 B
Docker
27 lines
653 B
Docker
# Stage 1: Build frontend
|
|
FROM node:20-alpine AS frontend-build
|
|
WORKDIR /app/frontend
|
|
COPY frontend/package.json frontend/package-lock.json* ./
|
|
RUN npm install
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: Backend runtime
|
|
FROM python:3.12-slim
|
|
WORKDIR /app
|
|
|
|
# Install Python dependencies
|
|
COPY backend/requirements.txt ./
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy backend code
|
|
COPY backend/ ./
|
|
|
|
# Copy built frontend into static directory
|
|
COPY --from=frontend-build /app/frontend/dist ./static
|
|
|
|
EXPOSE 8000
|
|
|
|
# Run migrations then start server
|
|
CMD ["sh", "-c", "alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000"]
|