diff --git a/Dockerfile b/Dockerfile
index af615dc343a401d6df0347f7e8aaa6a4f1e07626..60d9011359e260e80e78d2911dee14e15f946823 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,8 +3,6 @@ FROM ubuntu:focal
 # define geographic location during R installation
 ENV TZ=Etc/UTC
 ENV DEBIAN_FRONTEND=noninteractive
-ARG SHINY_SERVER_VERSION=latest
-ARG R_VERSION=latest
 
 EXPOSE 3838
 CMD ["shiny-server"]
@@ -41,6 +39,7 @@ COPY ./scripts/install_r_cran.sh /opt/scripts/install_r_cran.sh
 # Copy the R archive is already present, otherwise it will be downloaded
 # COPY ./R*.tar.gz /tmp/
 
+ARG R_VERSION=latest
 # Install R, along with its dependencies
 RUN /opt/scripts/install_r_cran.sh
 # Test R in another layer
@@ -49,6 +48,7 @@ RUN R -q -e "sessionInfo()"
 # Copy the remaining scripts
 COPY ./scripts /opt/scripts
 
+ARG SHINY_SERVER_VERSION=latest
 # Install R packages included Shiny, then install shiny server
 RUN /opt/scripts/configure_Rprofile.sh  \
  && Rscript /opt/scripts/install_r_packages.R