hfcron / Dockerfile
Ajitdoval's picture
Update Dockerfile
2fa6455 verified
Raw
History Blame Contribute Delete
1.49 kB
# Use an official Python slim image as the base
FROM python:3.10-slim
# Install system dependencies and Node.js (for Next.js)
RUN apt-get update && apt-get install -y curl && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# ==========================================
# 1. Setup Backend (Python)
# ==========================================
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# ==========================================
# 2. Setup Frontend (Node.js)
# ==========================================
WORKDIR /app/frontend
# Copy package.json from your frontend folder
COPY frontend/package*.json ./
RUN npm install
# Copy the remaining files from your frontend folder (if any)
COPY frontend/ ./
# MAGIC TRICK: Copy the scattered files from the ROOT into the container's frontend folder
COPY src/ ./src/
COPY tailwind.config.js ./
COPY tsconfig.json ./
COPY postcss.config.js ./
# Build the Next.js app
RUN npm run build
# ==========================================
# 3. Copy Backend Source and Startup Script
# ==========================================
WORKDIR /app
# Copy the backend folder
COPY backend/ ./backend/
# Copy start script
COPY start.sh ./
RUN chmod +x start.sh
# Expose the port Hugging Face Spaces expects
EXPOSE 7860
# Execute the startup script
CMD ["./start.sh"]