Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -20
Dockerfile
CHANGED
|
@@ -1,24 +1,12 @@
|
|
| 1 |
-
# ---
|
| 2 |
-
FROM node:20-alpine AS frontend
|
| 3 |
-
WORKDIR /ui
|
| 4 |
-
|
| 5 |
-
# Copy package files and install dependencies
|
| 6 |
-
COPY frontend/package*.json ./
|
| 7 |
-
RUN npm install --silent
|
| 8 |
-
|
| 9 |
-
# Copy frontend source and build
|
| 10 |
-
COPY frontend ./
|
| 11 |
-
RUN npm run build
|
| 12 |
-
|
| 13 |
-
# --- Backend Stage (FastAPI + Python) ---
|
| 14 |
FROM python:3.11-bullseye
|
|
|
|
|
|
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
# Install system dependencies
|
| 18 |
RUN apt-get update && \
|
| 19 |
apt-get install -y --no-install-recommends \
|
| 20 |
-
build-essential \
|
| 21 |
-
git \
|
| 22 |
ffmpeg \
|
| 23 |
libsm6 \
|
| 24 |
libxext6 \
|
|
@@ -27,7 +15,7 @@ RUN apt-get update && \
|
|
| 27 |
python3-dev \
|
| 28 |
&& rm -rf /var/lib/apt/lists/*
|
| 29 |
|
| 30 |
-
# Copy and install
|
| 31 |
COPY requirements.txt ./
|
| 32 |
RUN pip install --upgrade pip
|
| 33 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
@@ -39,11 +27,11 @@ COPY app.py Procfile .env.example ./
|
|
| 39 |
# Create folder for SQLite DB
|
| 40 |
RUN mkdir -p /app/data
|
| 41 |
|
| 42 |
-
# Copy built frontend
|
| 43 |
-
COPY
|
| 44 |
|
| 45 |
-
# Expose
|
| 46 |
EXPOSE 7860
|
| 47 |
|
| 48 |
-
#
|
| 49 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# --- Backend Stage (Python + FastAPI) ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
FROM python:3.11-bullseye
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Install system dependencies
|
| 8 |
RUN apt-get update && \
|
| 9 |
apt-get install -y --no-install-recommends \
|
|
|
|
|
|
|
| 10 |
ffmpeg \
|
| 11 |
libsm6 \
|
| 12 |
libxext6 \
|
|
|
|
| 15 |
python3-dev \
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
+
# Copy Python requirements and install
|
| 19 |
COPY requirements.txt ./
|
| 20 |
RUN pip install --upgrade pip
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 27 |
# Create folder for SQLite DB
|
| 28 |
RUN mkdir -p /app/data
|
| 29 |
|
| 30 |
+
# Copy pre-built frontend
|
| 31 |
+
COPY frontend/dist ./frontend_dist
|
| 32 |
|
| 33 |
+
# Expose port
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
+
# Start the app
|
| 37 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|