Update Dockerfile
Browse files- Dockerfile +21 -8
Dockerfile
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
-
# Install Tesseract OCR
|
| 4 |
-
RUN apt-get update && apt-get install -y
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# Set environment variables
|
| 7 |
-
ENV PYTHONDONTWRITEBYTECODE
|
| 8 |
-
ENV PYTHONUNBUFFERED
|
| 9 |
|
| 10 |
-
# Set
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
-
#
|
| 14 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 15 |
RUN pip install --upgrade pip
|
|
|
|
|
|
|
| 16 |
RUN pip install -r requirements.txt
|
| 17 |
|
| 18 |
-
# Copy
|
| 19 |
COPY . .
|
| 20 |
|
| 21 |
-
#
|
|
|
|
|
|
|
|
|
|
| 22 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 1 |
+
# Use the official Python 3.11 slim image as the base
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
+
# Install build-essential and Fortran compiler along with Tesseract OCR
|
| 5 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 6 |
+
build-essential \
|
| 7 |
+
gfortran \
|
| 8 |
+
tesseract-ocr \
|
| 9 |
+
libtesseract-dev \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
# Set environment variables
|
| 13 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 14 |
+
ENV PYTHONUNBUFFERED=1
|
| 15 |
|
| 16 |
+
# Set the working directory inside the container
|
| 17 |
WORKDIR /app
|
| 18 |
|
| 19 |
+
# Copy the requirements file into the container
|
| 20 |
COPY requirements.txt .
|
| 21 |
+
|
| 22 |
+
# Upgrade pip to the latest version
|
| 23 |
RUN pip install --upgrade pip
|
| 24 |
+
|
| 25 |
+
# Install Python dependencies from requirements.txt
|
| 26 |
RUN pip install -r requirements.txt
|
| 27 |
|
| 28 |
+
# Copy the rest of your application code into the container
|
| 29 |
COPY . .
|
| 30 |
|
| 31 |
+
# Expose port 8000 to the outside world
|
| 32 |
+
EXPOSE 8000
|
| 33 |
+
|
| 34 |
+
# Define the default command to run your application using Uvicorn
|
| 35 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|