diff --git a/Dockerfile b/Dockerfile
index 192653edc3e19a805cf44dba24f15d6e3c982c76..815225e3ac4c5e6d63f9ae2e31c4814df4fcce33 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -12,8 +12,8 @@ ENV DISCOURSE_VERSION=1.4.7 \
 RUN apt-get update && apt-get install -y --no-install-recommends imagemagick libxml2 \
  && rm -rf /var/lib/apt/lists/*
 
-RUN curl -L https://github.com/discourse/discourse/archive/v${DISCOURSE_VERSION}.tar.gz \
-  | tar -xz -C /usr/src/app --strip-components 1 \
+RUN git clone --branch v${DISCOURSE_VERSION} https://github.com/discourse/discourse.git . \
+ && git remote set-branches --add origin tests-passed \
  && bundle config build.nokogiri --use-system-libraries \
  && bundle install --deployment --without test --without development