diff --git a/Dockerfile b/Dockerfile
index 2452638fbd0c496c8574808058d9d23172f3c248..661bf92f020f36c0c8e29862640650f33ea95a94 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,21 @@
 FROM python:3.8
 
+ARG with_models=false
+
 WORKDIR /app
 
 RUN pip install --upgrade pip
 
 COPY . .
 
+# check for offline build
+RUN if [ "$with_models" = "true" ]; then  \
+        # install only the dependencies first
+        pip install -e .;  \
+        # initialize the language models
+        ./install_models.py;  \
+    fi
+
 # Install package from source code
 RUN pip install .