Reproducibility Workshop for Cognitive Science Orientation Bootcamp
Docker file
# Start with R version 4.3.2
FROM rocker/verse:4.3.2
# Install system dependencies for R packages
RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev
# Set the working directory to /home/rstudio
WORKDIR /home/rstudio
RUN R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))"
COPY renv.lock renv.lock
COPY renv renv
COPY renv.lock renv.lock
#COPY TSciM_workshop_code.R TSciM_workshop_code.R
#COPY GillanEtAl_eLife.rds GillanEtAl_eLife.rds
# Change ownership of the directory to the 'rstudio' user and activate 'renv'
RUN chown -R rstudio . \
&& sudo -u rstudio R -e 'source("renv/activate.R"); renv::restore()'
Instructions
These are the steps I used to build the docker image.
- Build the Docker image:
- Push the Docker image:
docker build . -t nghuixin/tscim_club_feb2024
docker push nghuixin/tscim_club_feb2024
To run the docker image, begin with this step:
- Pull the Docker image:
- Run the Docker container (no mounted volumes):
- Run the Docker container with mounted volumes:
docker pull nghuixin/tscim_club_feb2024:1.0
docker run --rm -p 8787:8787 -e DISABLE_AUTH=true nghuixin/tscim_club_feb2024:1.0
docker run -it -e DISABLE_AUTH=true -p 8787:8787 -v ${pwd}/TSciM_workshop_code.R:/home/rstudio/TSciM_workshop_code.R -v ${pwd}/GillanEtAl_eLife.rds:/home/rstudio/GillanEtAl_eLife.rds nghuixin/tscim_club_feb2024:1.0