diff --git a/Dockerfile b/Dockerfile
index ba50d91365a36ba68368f203ba1734a849c8bc2f..ab3c89cafc0baef92be3f7853cd30c462c83607c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,10 +2,6 @@ FROM rails
 
 WORKDIR /usr/src/app
 
-ARG DISCOURSE_VERSION=1.7.0.beta3
-ARG GIFSICLE_VERSION=1.87
-ARG PNGQUANT_VERSION=2.4.1
-
 ENV RAILS_ENV=production \
     RUBY_GC_MALLOC_LIMIT=90000000 \
     RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 \
@@ -13,6 +9,9 @@ ENV RAILS_ENV=production \
     DISCOURSE_REDIS_HOST=redis \
     DISCOURSE_SERVE_STATIC_ASSETS=true
 
+ARG GIFSICLE_VERSION=1.87
+ARG PNGQUANT_VERSION=2.4.1
+
 RUN curl --silent --location https://deb.nodesource.com/setup_4.x | bash - \
  && apt-get update && apt-get install -y --no-install-recommends \
       autoconf \
@@ -43,6 +42,8 @@ RUN curl --silent --location https://deb.nodesource.com/setup_4.x | bash - \
  && rm -fr /tmp/* \
  && rm -rf /var/lib/apt/lists/*
 
+ARG DISCOURSE_VERSION=1.7.0.beta3
+
 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