Skip to content
Snippets Groups Projects
Commit 0559ac4c authored by Pablo Iturrieta Rebolledo's avatar Pablo Iturrieta Rebolledo
Browse files

Dockerfile now set up container group/user for permission issues. Docker build...

Dockerfile now set up container group/user for permission issues. Docker build and run instructions are now detailed in README
parent 4213ee4e
No related branches found
No related tags found
No related merge requests found
......@@ -3,23 +3,26 @@
FROM rocker/r-ver:4.1.2
## Set up working directory
WORKDIR /usr/src/forecastMockUp
## Setup user args
ARG USERNAME=mockup
ARG USER_UID=1100
ARG USER_GID=$USER_UID
RUN groupadd --non-unique -g $USER_GID $USERNAME \
&& useradd -u $USER_UID -g $USER_GID -s /bin/sh -m $USERNAME
COPY . .
## Set up work directory in the Docker container
WORKDIR /usr/src/mockup_R/
#RUN apt-get update
## Copy the files from the local machine (the repository) to the Docker container
COPY --chown=$USER_UID:$USER_GID . /usr/src/mockup_R/
## Install linux libraries - need these to be versioned!
## RUN apt-get install -y libgdal-dev libproj-dev libgeos-dev libudunits2-dev libnode-dev libcairo2-dev libnetcdf-dev
#$ Install linux libraries - need these to be versioned!
#RUN apt-get install -y libgdal-dev libproj-dev libgeos-dev libudunits2-dev libnode-dev libcairo2-dev libnetcdf-dev
## Pending: Setting Up Ncpus in .Rprofile to match the machine cores
# Install any neccessary R packages like this:
#RUN Rscript -e "install.packages('renv')"
RUN groupadd docker && \
useradd -g docker modeler
USER modeler
## Docker now will be initialized as user
USER $USERNAME
......@@ -4,10 +4,20 @@ A repo demonstrating a mock-up forecast set-up using R.
This will generate a mock forecast with the required formatting for pyCSEP testing, generated from sampled events in the catalogue.
Takes in required forecast date from command line (example is "2020-01-01" below) and writes the output forecast to the forecasts folder
## Build docker
docker build -t {user}/mockup .
## Docker build
```
docker build \
--build-arg USERNAME=$USER \
--build-arg USER_UID=$(id -u) \
--build-arg USER_GID=$(id -g) \
--no-cache \
-t mockup_r .
```
## Run docker and create forecast
docker run --rm --volume {model_path}/mockup/:/usr/src/mockup:rw {user}/mockup Rscript run_forecast.R "2020-01-01"
```
docker run --rm --volume $PWD:/usr/src/mockup_R:rw mockup_r Rscript run_forecast.R "2020-01-01"
```
This diff is collapsed.
\name{hello}
\alias{hello}
\title{Hello, World!}
\usage{
hello()
}
\description{
Prints 'Hello, world!'.
}
\examples{
hello()
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment