diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000000000000000000000000000000000000..59070d1dcb64945e764a32f7ff041d3e90cfbd7a
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+.git
+Tests/Data
diff --git a/scripts/cmake/PreFind.cmake b/scripts/cmake/PreFind.cmake
index b4ae3a14c15e1ffb7bc0922009d703e3498cf1c0..6c028cb857b3b272504b6f0862dab5099a9e2ab7 100644
--- a/scripts/cmake/PreFind.cmake
+++ b/scripts/cmake/PreFind.cmake
@@ -16,7 +16,16 @@ execute_process(COMMAND ${GIT_EXECUTABLE} status
     RESULT_VARIABLE IS_GIT_REPO
     OUTPUT_QUIET)
 if(IS_GIT_REPO GREATER 0)
-    message(FATAL_ERROR "Source code at ${PROJECT_SOURCE_DIR} is not a git "
-        "repository! Please use git to obtain the source code! See "
-        "https://www.opengeosys.org/docs/devguide/getting-started/get-the-source-code/")
+    set(IS_GIT_REPO FALSE CACHE INTERNAL "")
+    if(DEFINED OGS_VERSION)
+        message(WARNING "Using user-provided OGS_VERSION: ${OGS_VERSION}!")
+        message(WARNING "Submodule setup is skipped!")
+    else()
+        message(FATAL_ERROR "No git repository found at ${PROJECT_SOURCE_DIR}! "
+            "Please use git to obtain the source code! See "
+            "https://www.opengeosys.org/docs/devguide/getting-started/get-the-source-code/"
+            " OR manually set the OGS_VERSION variable.")
+    endif()
+else()
+set(IS_GIT_REPO TRUE CACHE INTERNAL "")
 endif()
diff --git a/scripts/cmake/ProjectSetup.cmake b/scripts/cmake/ProjectSetup.cmake
index 10225564e6702d2cd3b1b3bb05e9fb90e1b8e722..d0fe0f7f19b02b46a6814bdbc250979c42e8ded1 100644
--- a/scripts/cmake/ProjectSetup.cmake
+++ b/scripts/cmake/ProjectSetup.cmake
@@ -28,6 +28,10 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
 set(CMAKE_MACOSX_RPATH 1)
 
+if(NOT IS_GIT_REPO)
+    return()
+endif()
+
 # Get version info from Git, implementation based on
 # https://github.com/tomtom-international/cpp-dependencies
 execute_process(
diff --git a/scripts/cmake/SubmoduleSetup.cmake b/scripts/cmake/SubmoduleSetup.cmake
index be0d9d3297437a84a1239fe236b2ba67487805fc..14b87e8af07f2f5bcb09c2cf1f5a9ee90f17039f 100644
--- a/scripts/cmake/SubmoduleSetup.cmake
+++ b/scripts/cmake/SubmoduleSetup.cmake
@@ -1,3 +1,7 @@
+if(NOT IS_GIT_REPO)
+    return()
+endif()
+
 # This file initializes the required submodules
 set(OGS_ADDITIONAL_SUBMODULES_TO_CHECKOUT "" CACHE STRING
     "User given submodules which should be checked out by CMake.")