Spaces:
Sleeping
Sleeping
| # Build frontend | |
| FROM node:18-alpine as frontend-build | |
| WORKDIR /frontend | |
| COPY podcraft/package*.json ./ | |
| RUN npm install | |
| COPY podcraft/ . | |
| RUN npm run build | |
| # Build backend | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user to run the application | |
| RUN useradd -m -u 1000 appuser | |
| # Copy and install Python dependencies | |
| COPY server/requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy backend code | |
| COPY server/ . | |
| # Create necessary directories | |
| RUN mkdir -p audio_storage transcripts logs | |
| # Set ownership and permissions for application directories | |
| RUN chown -R appuser:appuser /app \ | |
| && chmod -R 755 /app \ | |
| && chmod -R 777 /app/audio_storage \ | |
| && chmod -R 777 /app/transcripts \ | |
| && chmod -R 777 /app/logs | |
| # Copy frontend build to a static directory | |
| COPY --from=frontend-build /frontend/dist /app/static | |
| RUN chown -R appuser:appuser /app/static | |
| # Switch to non-root user | |
| USER appuser | |
| # Expose port | |
| EXPOSE 7860 | |
| # Start FastAPI application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |