File size: 1,191 Bytes
6c71315
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d7a8925
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 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"]