updated docke file
This commit is contained in:
60
Dockerfile
60
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
|
FROM python:3.11-slim
|
||||||
|
|
||||||
# Set the working directory in the container
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install runtime dependencies
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
libffi-dev \
|
libreoffice poppler-utils ffmpeg \
|
||||||
libssl-dev \
|
libffi-dev libssl-dev g++ curl libjpeg-dev zlib1g-dev \
|
||||||
g++ \
|
|
||||||
curl \
|
|
||||||
libjpeg-dev \
|
|
||||||
zlib1g-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install Rust
|
COPY . /app
|
||||||
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 --no-cache-dir -r requirements.txt
|
||||||
RUN pip install gunicorn
|
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
|
EXPOSE 5000
|
||||||
|
|
||||||
# Run the clear_db script, then the initialization script, and then Gunicorn
|
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "app:app"]
|
||||||
CMD ["sh", "-c", "python clear_db.py && python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app"]
|
|
||||||
67
Dockerfile-addertw
Normal file
67
Dockerfile-addertw
Normal file
@@ -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"]
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -18,5 +18,5 @@ services:
|
|||||||
- /home/pi/Desktop/digi-server/static:/app/static/uploads
|
- /home/pi/Desktop/digi-server/static:/app/static/uploads
|
||||||
# when setting allready exist and data are setted and is performed an update use second line of command
|
# when setting allready exist and data are setted and is performed an update use second line of command
|
||||||
command: sh -c "python clear_db.py && python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app"
|
command: sh -c "python clear_db.py && python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app"
|
||||||
#command: sh -c "python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app"
|
#command: sh -c "python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app"docker
|
||||||
#restart: unless-stopped
|
#restart: unless-stopped
|
||||||
|
|||||||
Reference in New Issue
Block a user