podcraft_web_app / Dockerfile.spaces
Nagesh Muralidhar
Update PodCraft for HuggingFace Spaces
80c42b8
raw
history blame
3.58 kB
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies including ffmpeg
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg \
build-essential \
curl \
gnupg \
&& rm -rf /var/lib/apt/lists/*
# Copy backend requirements and install
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install additional packages needed for serving frontend
RUN pip install --no-cache-dir python-multipart
# Copy backend code
COPY backend/ /app/backend/
# Create static directory with a placeholder index.html
RUN mkdir -p /app/static && \
echo '<!DOCTYPE html>\
<html lang="en">\
<head>\
<meta charset="UTF-8">\
<meta name="viewport" content="width=device-width, initial-scale=1.0">\
<title>PodCraft - Loading...</title>\
<style>\
body {\
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\
background-color: #1a1a2e;\
color: #ffffff;\
display: flex;\
flex-direction: column;\
align-items: center;\
justify-content: center;\
height: 100vh;\
margin: 0;\
text-align: center;\
}\
h1 {\
color: #8b5cf6;\
font-size: 2.5rem;\
margin-bottom: 1rem;\
}\
p {\
max-width: 600px;\
line-height: 1.6;\
margin-bottom: 2rem;\
}\
.loading {\
display: inline-block;\
position: relative;\
width: 80px;\
height: 80px;\
}\
.loading div {\
position: absolute;\
top: 33px;\
width: 13px;\
height: 13px;\
border-radius: 50%;\
background: #8b5cf6;\
animation-timing-function: cubic-bezier(0, 1, 1, 0);\
}\
.loading div:nth-child(1) {\
left: 8px;\
animation: loading1 0.6s infinite;\
}\
.loading div:nth-child(2) {\
left: 8px;\
animation: loading2 0.6s infinite;\
}\
.loading div:nth-child(3) {\
left: 32px;\
animation: loading2 0.6s infinite;\
}\
.loading div:nth-child(4) {\
left: 56px;\
animation: loading3 0.6s infinite;\
}\
@keyframes loading1 {\
0% {\
transform: scale(0);\
}\
100% {\
transform: scale(1);\
}\
}\
@keyframes loading3 {\
0% {\
transform: scale(1);\
}\
100% {\
transform: scale(0);\
}\
}\
@keyframes loading2 {\
0% {\
transform: translate(0, 0);\
}\
100% {\
transform: translate(24px, 0);\
}\
}\
</style>\
</head>\
<body>\
<h1>PodCraft</h1>\
<p>The AI-powered podcast generation platform is setting up. Please check back in a few minutes while we complete the build process.</p>\
<div class="loading">\
<div></div>\
<div></div>\
<div></div>\
<div></div>\
</div>\
</body>\
</html>' > /app/static/index.html
# Create directory for temporary files
RUN mkdir -p /app/temp_audio
# Set environment variables
ENV PYTHONPATH=/app
ENV MONGODB_URL="mongodb+srv://NageshBM:Nash166^@podcraft.ozqmc.mongodb.net/?retryWrites=true&w=majority&appName=Podcraft"
ENV OPENAI_API_KEY=""
# Create a simple main.py for the HuggingFace Space
RUN echo 'import sys\n\
import os\n\
# Add backend to Python path\n\
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "backend"))\n\
# Import the main app\n\
from backend.app.main import app' > /app/main.py
# Expose the port the app runs on
EXPOSE 7860
# HuggingFace Spaces expects the app to run on port 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]