Update Dockerfile
Browse files- Dockerfile +11 -48
Dockerfile
CHANGED
|
@@ -1,60 +1,23 @@
|
|
| 1 |
-
# Use Python
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
RUN apt-get update && apt-get install -y \
|
| 12 |
-
git \
|
| 13 |
-
libgl1 \
|
| 14 |
-
libglib2.0-0 \
|
| 15 |
-
wget \
|
| 16 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
-
|
| 18 |
-
# Clone the FastSD CPU repository
|
| 19 |
RUN git clone https://github.com/rupeshs/fastsdcpu.git .
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
RUN
|
| 23 |
-
ENV PATH="/app/env/bin:$PATH"
|
| 24 |
-
|
| 25 |
-
# Upgrade pip and install Python dependencies
|
| 26 |
-
RUN pip install --no-cache-dir --upgrade pip
|
| 27 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 28 |
-
|
| 29 |
-
# Install OpenVINO for performance optimization
|
| 30 |
-
RUN pip install --no-cache-dir openvino-dev
|
| 31 |
-
|
| 32 |
-
# Set cache directories for Hugging Face and Transformers
|
| 33 |
-
ENV HF_HOME=/app/cache/huggingface
|
| 34 |
-
ENV TRANSFORMERS_CACHE=/app/cache/huggingface/hub
|
| 35 |
-
ENV HUGGINGFACE_HUB_CACHE=/app/cache/huggingface/hub
|
| 36 |
-
|
| 37 |
-
# Create cache directory and set permissions
|
| 38 |
-
RUN mkdir -p /app/cache/huggingface/hub && chown -R appuser:appuser /app/cache
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
RUN
|
| 42 |
|
| 43 |
-
#
|
| 44 |
-
ENV OPENVINO_TELEMETRY_DIR=/app/cache/openvino
|
| 45 |
-
|
| 46 |
-
# Create OpenVINO telemetry directory and set permissions
|
| 47 |
-
RUN mkdir -p /app/cache/openvino && chown -R appuser:appuser /app/cache/openvino
|
| 48 |
-
|
| 49 |
-
# Switch to non-root user
|
| 50 |
-
USER appuser
|
| 51 |
-
|
| 52 |
-
# Expose port 8000 for the API server
|
| 53 |
EXPOSE 8000
|
| 54 |
|
| 55 |
-
#
|
| 56 |
-
|
| 57 |
-
ENV DEVICE=cpu
|
| 58 |
-
|
| 59 |
-
# Command to run the API server
|
| 60 |
-
CMD ["python", "src/app.py", "--api"]
|
|
|
|
| 1 |
+
# Use an official Python runtime as the base image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install git to clone the repository
|
| 8 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# Clone the repository
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
RUN git clone https://github.com/rupeshs/fastsdcpu.git .
|
| 12 |
|
| 13 |
+
# Install any Python dependencies if requirements.txt exists
|
| 14 |
+
#RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
# Ensure the start-webserver.sh script is executable
|
| 17 |
+
RUN chmod +x start-webserver.sh
|
| 18 |
|
| 19 |
+
# Expose port if the webserver uses a specific port (default to 8000, adjust if needed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
EXPOSE 8000
|
| 21 |
|
| 22 |
+
# Run the start-webserver.sh script
|
| 23 |
+
CMD ["./start-webserver.sh"]
|
|
|
|
|
|
|
|
|
|
|
|