Comments (1)
I have the solution. Here are the files:
docker files (changes R packages you want to install, but need reticulate):
# Dockerfile
FROM rocker/r-base:4.2.1
# install the linux libraries needed for plumber
RUN apt-get update --fix-missing \
&& apt-get install -y \
ca-certificates \
build-essential \
libprotobuf-dev \
protobuf-compiler \
cmake \
libglib2.0-0 \
libxext6 \
libsm6 \
libxrender1 \
libcurl4-gnutls-dev \
libxml2-dev \
libsndfile1 \
libx11-dev \
libatlas-base-dev \
libgtk-3-dev \
libboost-python-dev \
libsodium-dev \
ffmpeg \
python3-audioread \
libssl-dev \
openssl \
python3-openssl \
pkg-config
# RUN apt-get update -qq && apt-get install -y \
# libssl-dev \
# libcurl4-gnutls-dev \
# libsodium-dev
# create the application folder
RUN mkdir -p ~/application
# copy everything from the current directory into the container
COPY "/" "application/"
WORKDIR "application/"
# open port 8080 to traffic
EXPOSE 8080
# install packages
RUN R -e "install.packages('stats')"
RUN R -e "install.packages('plumber')"
RUN R -e "install.packages('utils')"
RUN R -e "install.packages('theft')"
RUN R -e "install.packages('quarks')"
RUN R -e "install.packages('tvgarch')"
RUN R -e "install.packages('mlr3')"
RUN R -e "install.packages('mlr3pipelines')"
RUN R -e "install.packages('mlr3filters')"
RUN R -e "install.packages('mlr3fselect')"
RUN R -e "install.packages('mlr3learners')"
RUN R -e "install.packages('mlr3tuning')"
RUN R -e "install.packages('fastICA')"
RUN R -e "install.packages('bestNormalize')"
RUN R -e "install.packages('mlr3verse')"
RUN R -e "install.packages('data.table')"
RUN R -e "install.packages('exuber')"
RUN R -e "install.packages('remotes')"
RUN R -e "install.packages('ranger')"
RUN R -e "remotes::install_github('https://github.com/MislavSag/finfeatures')"
RUN R -e "remotes::install_github('https://github.com/mlr-org/mlr3extralearners')"
# install python and packages
RUN apt-get -y install python3 python3-venv python3-pip
RUN python3 -m venv /home/rstudio/venv
RUN /home/rstudio/venv/bin/pip3 install --upgrade pip setuptools wheel
RUN /home/rstudio/venv/bin/pip3 install tsfel
RUN /home/rstudio/venv/bin/pip3 install scipy==1.8.1
# when the container starts, start the main R script
ENTRYPOINT ["Rscript", "execute_plumber.R"]
plumber file example:
# plumber.R
library(plumber)
library(exuber)
library(finfeatures)
library(data.table)
library(mlr3)
library(mlr3verse)
library(mlr3extralearners)
library(mlr3pipelines)
library(mlr3filters)
library(mlr3fselect)
library(mlr3learners)
library(mlr3tuning)
library(tvgarch)
library(runner)
library(theft)
library(quarks)
library(reticulate)
library(feasts)
# learners
library(ranger)
library(stats)
library(fastICA)
library(bestNormalize)
# import mlr3 models
model <- readRDS(file = 'hftmlr_model.rds')
# python virtual environment
ve <- tryCatch(reticulate::use_virtualenv("/home/rstudio/venv"), error = function(e) e)
print(ve)
# reticulate::use_python("C:/ProgramData/Anaconda3/envs/mlfinlabenv/python.exe", required = TRUE)
#* Echo back the input
#* @param msg The message to echo
#* @get /echo
function(msg="") {
list(msg = paste0("The message is: '", msg, "'"))
}
#* Plot a histogram
#* @serializer png
#* @get /plot
function() {
rand <- rnorm(100)
hist(rand)
}
#* Return the sum of two numbers
#* @param a The first number to add
#* @param b The second number to add
#* @post /sum
function(a, b) {
as.numeric(a) + as.numeric(b)
}
Execute plumber file:
# Execute plumber
plumber::plumb(file="plumber.R")$run(host = '0.0.0.0', port = 8080)
from rocker.
Related Issues (20)
- cannot build docker due to usrmerge failing HOT 4
- `'lib = "/usr/local/lib/R/site-library"' is not writable` error when install R packages by non-root user HOT 3
- wiki: best practices for creating dockerfiles HOT 6
- `r-base` (Docker Official Image) is not updated HOT 5
- Migrating from Dockerhub? HOT 3
- Container for RStudio (not server) HOT 1
- MRAN repository snapshots were deleted - Failing jobs because packages can't be found anymore HOT 5
- docker v18 & packages repositories & rocker's images HOT 5
- unable to load shared object
- Update results in deletion of all install package...
- installation testing fails HOT 1
- r: error while loading shared libraries: libR.so: cannot open shared object file: No such file or directory
- Docker image r-base:4.2.1 not reproducible HOT 4
- Installing unstable apt packages? HOT 4
- Local Zotero Integration? HOT 3
- R session terminated HOT 1
- latest r-base breaks install of `curl` package HOT 8
- xz-utils backdoor HOT 4
- Potential high vulnerability in r-base:4.3.1 HOT 3
- Installing packages fails due to broken openssl package in debian testing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rocker.