Spaces:
Build error
Build error
# Multi-stage build for the application | |
FROM node:18-alpine AS frontend-builder | |
# Set working directory for frontend build | |
WORKDIR /app/frontend | |
# Copy frontend package files | |
COPY metsa-frontend/package*.json ./ | |
# Install frontend dependencies | |
RUN npm install --force | |
# Copy frontend source code | |
COPY metsa-frontend/ ./ | |
# Build frontend | |
RUN npm run build | |
# Python dependencies stage | |
FROM python:3.11-slim AS python-deps | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
gcc \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set working directory | |
WORKDIR /app | |
# Copy backend requirements | |
COPY requirements.txt ./ | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Final stage - Python runtime | |
FROM python:3.11-slim | |
# Install only runtime dependencies | |
RUN apt-get update && apt-get install -y \ | |
libpq5 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set working directory | |
WORKDIR /app | |
# Copy installed packages from python-deps stage | |
COPY --from=python-deps /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages | |
COPY --from=python-deps /usr/local/bin /usr/local/bin | |
# Copy backend application code | |
COPY metsa-backend/ ./ | |
# Copy built frontend files from the builder stage to the expected location | |
COPY --from=frontend-builder /app/frontend/out ./metsa-frontend/out | |
# Create uploads directory structure | |
RUN mkdir -p uploads/commercial \ | |
&& mkdir -p uploads/compliance \ | |
&& mkdir -p uploads/other | |
# Set environment variables | |
ENV PORT=8000 | |
ENV APP_NAME="Document Portal API" | |
ENV APP_VERSION="1.0.0" | |
ENV DEBUG=True | |
ENV MONGODB_URL=mongodb+srv://lawyerlit11:3uN39xD2C2lGiMyY@cluster0.rqm6zmq.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0 | |
ENV DATABASE_NAME=document_portal | |
ENV SECRET_KEY=your-secret-key-here-change-in-production | |
ENV ALGORITHM=HS256 | |
ENV ACCESS_TOKEN_EXPIRE_MINUTES=1440 | |
ENV SMTP_HOST=smtp.gmail.com | |
ENV SMTP_PORT=587 | |
ENV SMTP_USER=your-email@gmail.com | |
ENV SMTP_PASSWORD=your-app-password | |
ENV EMAILS_FROM_EMAIL=noreply@metsa.com | |
ENV EMAILS_FROM_NAME="Metsa Document Portal" | |
ENV UPLOAD_DIR=uploads | |
ENV MAX_FILE_SIZE=10485760 | |
# Expose the port | |
EXPOSE 8000 | |
# Start the application | |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] | |