Upload Dockerfile
Browse files- Dockerfile +13 -14
Dockerfile
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
# 1. Base Image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Ensure Python output is
|
| 5 |
ENV PYTHONUNBUFFERED=1
|
| 6 |
|
| 7 |
-
# 2. Install system dependencies
|
| 8 |
RUN apt-get update && \
|
| 9 |
apt-get install -y --no-install-recommends \
|
| 10 |
libgl1 \
|
|
@@ -12,29 +12,28 @@ RUN apt-get update && \
|
|
| 12 |
libsm6 libxext6 libxrender1 \
|
| 13 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
# 3. Set
|
| 16 |
WORKDIR /app
|
| 17 |
|
| 18 |
-
# 4. Copy dependency file
|
| 19 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
-
#
|
|
|
|
| 23 |
RUN mkdir -p /.EasyOCR && chmod -R 777 /.EasyOCR
|
| 24 |
RUN mkdir -p /app/easyocr_models && chmod -R 777 /app/easyocr_models
|
| 25 |
|
| 26 |
-
#
|
| 27 |
COPY . .
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
# You can uncomment this line for debugging:
|
| 31 |
-
# RUN ls -al /app
|
| 32 |
-
|
| 33 |
-
# 8. Environment variables for the app
|
| 34 |
ENV PORT=7860
|
| 35 |
|
| 36 |
-
# 9. Expose
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
-
# 10.
|
| 40 |
CMD exec gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 app:app
|
|
|
|
| 1 |
+
# 1. Base Image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Ensure Python output is unbuffered
|
| 5 |
ENV PYTHONUNBUFFERED=1
|
| 6 |
|
| 7 |
+
# 2. Install system dependencies for EasyOCR & OpenCV
|
| 8 |
RUN apt-get update && \
|
| 9 |
apt-get install -y --no-install-recommends \
|
| 10 |
libgl1 \
|
|
|
|
| 12 |
libsm6 libxext6 libxrender1 \
|
| 13 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
+
# 3. Set working directory
|
| 16 |
WORKDIR /app
|
| 17 |
|
| 18 |
+
# 4. Copy dependency file
|
| 19 |
COPY requirements.txt .
|
| 20 |
+
|
| 21 |
+
# 5. Install Python dependencies
|
| 22 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
|
| 24 |
+
# 6. Create necessary directories with write permissions
|
| 25 |
+
RUN mkdir -p /app/uploads && chmod -R 777 /app/uploads
|
| 26 |
RUN mkdir -p /.EasyOCR && chmod -R 777 /.EasyOCR
|
| 27 |
RUN mkdir -p /app/easyocr_models && chmod -R 777 /app/easyocr_models
|
| 28 |
|
| 29 |
+
# 7. Copy all project files
|
| 30 |
COPY . .
|
| 31 |
|
| 32 |
+
# 8. Environment variables
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
ENV PORT=7860
|
| 34 |
|
| 35 |
+
# 9. Expose port
|
| 36 |
EXPOSE 7860
|
| 37 |
|
| 38 |
+
# 10. Start app using Gunicorn
|
| 39 |
CMD exec gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 app:app
|