Update Dockerfile.cpu
alpine doesn't have torch
This commit is contained in:
@@ -1,34 +1,35 @@
|
|||||||
# Stage 1: Build dependencies in a full-featured Python image
|
# === Stage 1: Build dependencies and install packages ===
|
||||||
FROM python:3.11-alpine AS builder
|
FROM python:3.11-slim-bullseye AS builder
|
||||||
|
|
||||||
WORKDIR /subgen
|
WORKDIR /subgen
|
||||||
|
|
||||||
# Install dependencies required for building wheels
|
# Install required build dependencies
|
||||||
RUN apk add --no-cache \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
cmake \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
git \
|
git \
|
||||||
build-base \
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
python3-dev \
|
|
||||||
libffi-dev
|
|
||||||
|
|
||||||
# Copy and install Python dependencies
|
# Copy and install dependencies
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
||||||
|
|
||||||
# Stage 2: Create a minimal final image
|
# === Stage 2: Create a minimal runtime image ===
|
||||||
FROM python:3.11-alpine
|
FROM python:3.11-slim-bullseye AS runtime
|
||||||
|
|
||||||
WORKDIR /subgen
|
WORKDIR /subgen
|
||||||
|
|
||||||
# Install runtime dependencies (minimal set)
|
# Install only required runtime dependencies
|
||||||
RUN apk add --no-cache ffmpeg git
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
ffmpeg \
|
||||||
|
git \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy only the required files from the builder stage
|
# Copy only necessary files from builder stage
|
||||||
COPY --from=builder /install /usr/local
|
COPY --from=builder /install /usr/local
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
COPY launcher.py subgen.py language_code.py /subgen/
|
COPY launcher.py subgen.py language_code.py /subgen/
|
||||||
|
|
||||||
# Set environment variable for cleaner output
|
CMD ["python3", "launcher.py"]
|
||||||
ENV PYTHONUNBUFFERED=1
|
|
||||||
|
|
||||||
# Run the application
|
|
||||||
CMD ["python3", "-u", "launcher.py"]
|
|
||||||
|
|||||||
Reference in New Issue
Block a user