diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..67d3ee42
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,39 @@
+# Use the Python 3.11 slim image as the base image
+FROM python:3.11-slim
+
+# Set the working directory inside the container
+WORKDIR /app
+
+# Enable non-interactive mode for debconf
+RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
+
+# Update the package repository and install required dependencies
+RUN apt-get update -y && \
+ apt-get install -y build-essential cmake unzip pkg-config \
+ libjpeg-dev libpng-dev libtiff-dev \
+ libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
+ libatlas-base-dev gfortran && \
+ apt-get clean && \
+ apt-get -y autoremove
+
+# Install Python dependencies
+RUN pip3 install --user opencv-python-headless opencv-contrib-python-headless
+
+# Copy over the development and production requirements files
+COPY ./requirements.dev.txt /app
+COPY ./requirements.txt /app
+
+# Install additional Python dependencies for development
+RUN pip3 install -r requirements.dev.txt
+
+# Copy the entire project into the container
+COPY . /app
+
+# Clean up pip cache
+RUN pip3 cache purge
+
+# Set environment variables
+ENV OMR_CHECKER_CONTAINER True
+
+# Set the default command to run the main Python script
+CMD ["python3", "/app/main.py", "--inputDir", "/app/inputs/", "--outputDir", "/app/outputs/"]
diff --git a/README.md b/README.md
index ca796be2..27a3dd21 100644
--- a/README.md
+++ b/README.md
@@ -210,6 +210,58 @@ Command: python3 -m pip install --user --upgrade pip
Link to Solution: #70
+## Running OMRChecker in a Docker Container
+
+If you prefer to run OMRChecker in isolation without impacting your system's Python environment, you can utilize Docker. Follow the steps below to set it up:
+
+### Docker Installation
+
+1. **Install Docker Desktop:**
+ - For Windows and macOS users, download and install Docker Desktop from [Docker Hub](https://docs.docker.com/desktop/).
+ - For Linux users, follow the instructions provided in the official [Docker documentation](https://docs.docker.com/desktop/install/linux-install/) for your specific distribution.
+
+2. **Verify Installation:**
+ - After installation, open a terminal (or command prompt) and run the following command to verify that Docker is installed correctly:
+ ```bash
+ docker --version
+ ```
+ - This should display the installed Docker version, indicating that Docker is installed successfully.
+
+
+### Running OMRChecker in Docker
+
+Once Docker is installed, you can run OMRChecker within a Docker container by following these steps:
+
+1. Clone the repository and navigate into it:
+
+ ```bash
+ git clone https://github.com/Udayraj123/OMRChecker
+ cd OMRChecker/
+ ```
+
+2. Build the Docker container image (Initial build may take up to 2 minutes depending on your network connection):
+
+ ```bash
+ docker buildx build -t omrchecker:1.0 .
+ ```
+
+3. Run the Docker container to process the exam images:
+
+ - First, ensure you have your exam images, target image, and `template.json` file ready in the `inputs` directory.
+
+ - Now, run the container, which will automatically mark the exams and place the results in the `outputs/` directory:
+
+ ```bash
+ docker run -t --rm -v $(pwd)/inputs/:/app/inputs/ -v $(pwd)/outputs/:/app/outputs/ omrchecker:1.0
+ ```
+
+ This command mounts the `inputs/` and `outputs/` directories from your host machine to the respective directories inside the container, allowing data exchange.
+
+4. After the process completes, you can find the marked exams in the `outputs/` directory.
+
+By following these steps, you can efficiently use OMRChecker within a Docker container without affecting your local Python environment.
+
+
## OMRChecker for custom OMR Sheets
1. First, [create your own template.json](https://github.com/Udayraj123/OMRChecker/wiki/User-Guide).
diff --git a/src/utils/.Dockerignore b/src/utils/.Dockerignore
new file mode 100644
index 00000000..ecc4fc60
--- /dev/null
+++ b/src/utils/.Dockerignore
@@ -0,0 +1,2 @@
+samples/
+src/tests/
\ No newline at end of file
diff --git a/src/utils/interaction.py b/src/utils/interaction.py
index 1036f5b3..d0d0be5f 100644
--- a/src/utils/interaction.py
+++ b/src/utils/interaction.py
@@ -1,12 +1,18 @@
+import os
from dataclasses import dataclass
import cv2
-from screeninfo import get_monitors
+from screeninfo import Monitor, get_monitors
from src.logger import logger
from src.utils.image import ImageUtils
-monitor_window = get_monitors()[0]
+# If running in a container, make a fake monitor
+monitor_window = (
+ Monitor(0, 0, 1000, 1000, 100, 100, "FakeMonitor", False)
+ if os.environ.get("OMR_CHECKER_CONTAINER")
+ else get_monitors()[0]
+)
@dataclass
@@ -25,6 +31,9 @@ class InteractionUtils:
@staticmethod
def show(name, origin, pause=1, resize=False, reset_pos=None, config=None):
+ if(os.environ.get("OMR_CHECKER_CONTAINER")):
+ return
+
image_metrics = InteractionUtils.image_metrics
if origin is None:
logger.info(f"'{name}' - NoneType image to show!")