From 7eb8f088f4af0297e808432e16b011ea686bfd83 Mon Sep 17 00:00:00 2001 From: Scheianu Ionut Date: Sun, 18 May 2025 23:24:17 +0300 Subject: [PATCH] updated docke file --- Dockerfile | 60 ++-------------------- Dockerfile-addertw | 67 +++++++++++++++++++++++++ __pycache__/app.cpython-311.pyc | Bin 47621 -> 47621 bytes __pycache__/extensions.cpython-311.pyc | Bin 433 -> 433 bytes __pycache__/models.cpython-311.pyc | Bin 5091 -> 5091 bytes docker-compose.yml | 2 +- 6 files changed, 73 insertions(+), 56 deletions(-) create mode 100644 Dockerfile-addertw diff --git a/Dockerfile b/Dockerfile index 618366c..b86140e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,67 +1,17 @@ -# Stage 1: Build stage -FROM python:3.11-slim AS build - -# Set the working directory in the container -WORKDIR /app - -# Install build tools and libraries -RUN apt-get update && apt-get install -y \ - build-essential \ - libffi-dev \ - libssl-dev \ - python3-dev \ - cargo \ - g++ \ - curl \ - libjpeg-dev \ - zlib1g-dev \ - && rm -rf /var/lib/apt/lists/* - -# Install Rust -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -ENV PATH="/root/.cargo/bin:${PATH}" - -# Upgrade pip to the latest version -RUN pip install --upgrade pip - -# Copy the current directory contents into the container at /app -COPY . /app - -# Install any needed packages specified in requirements.txt -RUN pip install --no-cache-dir -r requirements.txt - -# Stage 2: Runtime stage FROM python:3.11-slim -# Set the working directory in the container WORKDIR /app -# Install runtime dependencies RUN apt-get update && apt-get install -y \ - libffi-dev \ - libssl-dev \ - g++ \ - curl \ - libjpeg-dev \ - zlib1g-dev \ + libreoffice poppler-utils ffmpeg \ + libffi-dev libssl-dev g++ curl libjpeg-dev zlib1g-dev \ && rm -rf /var/lib/apt/lists/* -# Install Rust -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -ENV PATH="/root/.cargo/bin:${PATH}" +COPY . /app -# Copy only the necessary files from the build stage -COPY --from=build /app /app -COPY --from=build /root/.cargo /root/.cargo - -# Install Gunicorn and other Python dependencies -COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN pip install gunicorn -RUN apt-get update && apt-get install -y libreoffice poppler-utils -RUN apt-get install ffmpeg -y -# Make port 5000 available to the world outside this container + EXPOSE 5000 -# Run the clear_db script, then the initialization script, and then Gunicorn -CMD ["sh", "-c", "python clear_db.py && python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app"] \ No newline at end of file +CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "app:app"] \ No newline at end of file diff --git a/Dockerfile-addertw b/Dockerfile-addertw new file mode 100644 index 0000000..a6dadf9 --- /dev/null +++ b/Dockerfile-addertw @@ -0,0 +1,67 @@ +# Stage 1: Build stage +FROM python:3.11-slim AS build + +# Set the working directory in the container +WORKDIR /app + +# Install build tools and libraries +RUN apt-get update && apt-get install -y \ + build-essential \ + libffi-dev \ + libssl-dev \ + python3-dev \ + cargo \ + g++ \ + curl \ + libjpeg-dev \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +# Upgrade pip to the latest version +RUN pip install --upgrade pip + +# Copy the current directory contents into the container at /app +COPY . /app + +# Install any needed packages specified in requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Stage 2: Runtime stage +FROM python:3.11-slim + +# Set the working directory in the container +WORKDIR /app + +# Install runtime dependencies +RUN apt-get update && apt-get install -y \ + libffi-dev \ + libssl-dev \ + g++ \ + curl \ + libjpeg-dev \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +# Copy only the necessary files from the build stage +COPY --from=build /app /app +COPY --from=build /root/.cargo /root/.cargo + +# Install Gunicorn and other Python dependencies +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt +RUN pip install gunicorn +RUN apt-get update && apt-get install -y libreoffice poppler-utils ffmpeg + +# Make port 5000 available to the world outside this container +EXPOSE 5000 + +# Run the clear_db script, then the initialization script, and then Gunicorn +CMD ["sh", "-c", "python clear_db.py && python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app"] \ No newline at end of file diff --git a/__pycache__/app.cpython-311.pyc b/__pycache__/app.cpython-311.pyc index a1cd99afb4aa853b602a89821a501f409bb65bbe..a18e50a4a709dadd9bcf9a9158efc37f241d206a 100644 GIT binary patch delta 22 ccmZqu!qobOiF-LOFBbz4WLRr$l208z&W2><{9 delta 22 ccmZqu!qobOiF-LOFBbz4NGYgql208aD