diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..779c255 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# Stage 1: Build React frontend +FROM node:22-alpine AS frontend +WORKDIR /app/web/frontend +COPY web/frontend/package.json web/frontend/package-lock.json ./ +RUN npm ci +COPY web/frontend/ ./ +RUN npm run build + +# Stage 2: Python app +FROM python:3.12-slim +WORKDIR /app + +# Install Python deps +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt gunicorn + +# Copy app source +COPY . . + +# Copy built frontend from stage 1 +COPY --from=frontend /app/web/frontend/dist /app/web/frontend/dist + +# Create runtime directories +RUN mkdir -p /app/state/queue /app/media/music /app/media/podcasts /app/media/fallback /app/logs + +# Initialize the database +RUN python scripts/init_db.py /app/state/radio.db + +EXPOSE 5000 + +CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "2", "--timeout", "120", "web.app:app"]