ever-brain / Dockerfile
AlexKurian's picture
chore: update gitignore to preserve exe files and improve Docker start script indentation
ba8a3d1
Raw
History Blame Contribute Delete
1.12 kB
# Use Python 3.11 as base
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
gnupg \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# 1. Copy project structure first
COPY pyproject.toml .
COPY brain ./brain
COPY scripts ./scripts
COPY README.md .
# 2. Install the package so 'import brain' works
RUN pip install .
RUN pip install fastapi uvicorn
# 3. Copy backend
COPY web/backend ./web/backend
# 4. Copy frontend and build it
COPY web/frontend ./web/frontend
WORKDIR /app/web/frontend
RUN npm install
RUN npm run build
# Back to root
WORKDIR /app
# Copy the built binary (if present)
COPY dist ./dist
# Create a shell script to start both services
RUN echo '#!/bin/bash\n\
uvicorn web.backend.main:app --host 0.0.0.0 --port 8000 &\n\
cd web/frontend && npm run start -- -p 7860\n\
' > start.sh
RUN chmod +x start.sh
# Expose the port Hugging Face expects
EXPOSE 7860
# Start the services
CMD ["./start.sh"]