attempt to make the image smaller
This commit is contained in:
@@ -1,23 +1,34 @@
|
||||
FROM python:3.11-slim-bullseye
|
||||
# Stage 1: Build dependencies in a full-featured Python image
|
||||
FROM python:3.11-alpine AS builder
|
||||
|
||||
WORKDIR /subgen
|
||||
|
||||
ADD https://raw.githubusercontent.com/McCloudS/subgen/main/requirements.txt /subgen/requirements.txt
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
python3 \
|
||||
python3-pip \
|
||||
# Install dependencies required for building wheels
|
||||
RUN apk add --no-cache \
|
||||
ffmpeg \
|
||||
git \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& pip install -r requirements.txt
|
||||
build-base \
|
||||
python3-dev \
|
||||
libffi-dev
|
||||
|
||||
# Copy and install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
||||
|
||||
# Stage 2: Create a minimal final image
|
||||
FROM python:3.11-alpine
|
||||
|
||||
WORKDIR /subgen
|
||||
|
||||
# Install runtime dependencies (minimal set)
|
||||
RUN apk add --no-cache ffmpeg git
|
||||
|
||||
# Copy only the required files from the builder stage
|
||||
COPY --from=builder /install /usr/local
|
||||
COPY launcher.py subgen.py language_code.py /subgen/
|
||||
|
||||
# Set environment variable for cleaner output
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
ADD https://raw.githubusercontent.com/McCloudS/subgen/main/launcher.py /subgen/launcher.py
|
||||
ADD https://raw.githubusercontent.com/McCloudS/subgen/main/subgen.py /subgen/subgen.py
|
||||
ADD https://raw.githubusercontent.com/McCloudS/subgen/main/language_code.py /subgen/language_code.py
|
||||
|
||||
CMD [ "bash", "-c", "python3 -u launcher.py" ]
|
||||
# Run the application
|
||||
CMD ["python3", "-u", "launcher.py"]
|
||||
|
||||
Reference in New Issue
Block a user