podcraft_web_app / Dockerfile
Nagesh Muralidhar
make changes
1bcce96
raw
history blame
1.26 kB
FROM python:3.11-slim
WORKDIR /app
# Install ffmpeg and other dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg \
build-essential \
nodejs \
npm \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy the application code
COPY . .
# Execute the build frontend script to prepare frontend code
RUN chmod +x build_frontend.sh && ./build_frontend.sh
# Build frontend
WORKDIR /app/frontend/podcraft
RUN npm install && \
npm run build || \
(echo "Frontend build failed, creating dummy build directory" && \
mkdir -p build && \
echo "<html><body><h1>PodCraft</h1><p>Frontend not built correctly. Please check logs.</p></body></html>" > build/index.html)
# Return to app directory and install backend dependencies
WORKDIR /app
RUN pip install --no-cache-dir -r requirements.txt
# Create static directory and copy the built frontend
RUN mkdir -p ./static && \
cp -r frontend/podcraft/build/* ./static/ || echo "No frontend build files to copy"
# Create directories for temp files
RUN mkdir -p temp_audio temp
# Default environment variables
ENV PORT=7860
ENV HOST=0.0.0.0
# Expose the port
EXPOSE 7860
# Command to run the application
CMD ["python", "app.py"]