Issues installing R-3.4.2 from Docker file

I am using Docker in order to install R . Code of my Docker file looks like as follows also thanks to previous suggestion by @HansKilian here which helped me solving a first issue!

 FROM python:3.7
    RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010 CBF8D6FD518E17E1
    RUN apt-get update && apt-get install -y default-jre gfortran && apt-get install nano
     
    
    # installing R
    RUN wget https://cran.r-project.org/src/base/R-3/R-3.4.2.tar.gz
    RUN tar zxf R-3.4.2.tar.gz
    RUN cd R-3.4.2 && ./configure --enable-R-shlib=yes && make && make install

Now, I get some compilation errors with R

    /usr/bin/ld: connections.o: warning: relocation against `R_OutputCon' in read-only section `.text'
/usr/bin/ld: connections.o: relocation R_X86_64_PC32 against symbol `R_OutputCon' can not be used when making a shared object; recompile with -fPIC

This seems related to problems described here. This configuration was working in 2020 when I originally created this Docker file which I am adapting for a new project. Ideally, it would be great to be able to have it running with the current specifications; thank you in advance if you can provide support in this direction.

In the worst case scenario, I can also rely on different R version . However, the following packages will need to be installed later on

   # installing R packages
RUN echo 'install.packages(c( \
  "doParallel", \
  "dplyr", \
  "dynamicTreeCut", \
  "foreach", \
  "iterators", \
  "glmnet", \
  "GPArotation", \
  "lme4", \
  "missForest", \
  "mpath", \
  "numDeriv", \
  "psych", \
  "pscl", \
  "qgraph", \
  "tidyr" \
  ), \
  repos="http://cran.us.r-project.org", dependencies=TRUE)' > /tmp/packages.R && \
  Rscript /tmp/packages.R && \
  rm -rf /workdir/R-3.4.2*

Thanks for your attention and help

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum