Comments (1)
Probably easier to allow changing R image via ARG, here is Ubuntu/plumber example:
- define default ARG that can be overridden at build time: https://docs.openfaas.com/cli/build/#30-pass-custom-build-arguments
- remove dependency on littler, so that rstudio images can be used
- also copy and install deps from DESCRIPTION before moving the
/function
folder: this improves build caching
ARG WATCHDOG_VERSION="0.8.4"
ARG R_IMAGE="rocker/r-ubuntu:18.04"
#FROM ghcr.io/openfaas/of-watchdog:0.8.4 as watchdog
#FROM rocker/r-ubuntu:18.04
FROM ghcr.io/openfaas/of-watchdog:${WATCHDOG_VERSION} as watchdog
FROM ${R_IMAGE}
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog
# Install system requirements for index.R as needed
RUN apt-get update && apt-get install -y \
--no-install-recommends \
make \
git-core \
libssl-dev \
libcurl4-gnutls-dev \
curl \
libsodium-dev \
libxml2-dev \
libicu-dev \
libstdc++6 \
&& rm -rf /var/lib/apt/lists/*
# Change options as needed in Rprofile.site
COPY Rprofile.site /etc/R
ENV _R_SHLIB_STRIP_=true
# Install basic dependencies for index.R
# some packages seem to require build from source
RUN R -q -e 'install.packages(c("Rcpp", "stringi", "httpuv", "remotes", "plumber"), repos=c(CRAN = "https://cloud.r-project.org"))'
#RUN install2.r -e remotes plumber
COPY install.R /usr/local/bin/
COPY function/DESCRIPTION .
# Istall SystemRequirements for handler.R from DESCRIPTION
RUN R -q -e 'source("/usr/local/bin/install.R");install$sysreqs()'
RUN echo requirements.txt
RUN apt-get update
RUN xargs -a requirements.txt apt-get install -y --no-install-recommends
RUN rm -rf /var/lib/apt/lists/*
RUN rm requirements.txt
# Install packages (incl. remotes) for handler.R from DESCRIPTION
RUN R -q -e 'remotes::install_deps()'
# Install VersionedPackages for handler.R from DESCRIPTION
RUN R -q -e 'source("/usr/local/bin/install.R");install$versioned()'
RUN rm -f ./DESCRIPTION
# Create a non-root user
RUN addgroup --system app \
&& adduser --system --ingroup app app
WORKDIR /home/app
COPY index.R .
COPY function .
# Switch to app user
RUN chown app:app -R /home/app
USER app
ENV fprocess="Rscript index.R"
ENV mode="http"
ENV http_upstream_url="http://127.0.0.1:5000"
HEALTHCHECK --interval=5s CMD [ -e /tmp/.lock ] || exit 1
CMD ["fwatchdog"]
from openfaas-rstats-templates.
Related Issues (17)
- Templates need non-root user
- Dependency management for rstats faas HOT 1
- System dependencies as build options/arguments HOT 2
- Add FaaS template based on RestRserve HOT 5
- Add FaaS template based on beakr
- ROADMAP HOT 3
- Add R function examples HOT 1
- install_deps does not respect Remotes field HOT 1
- Add FaaS template based on fiery HOT 1
- Explore OpenCPU microservice and JSON RPC HOT 1
- Add FaaS template based on httpuv HOT 1
- Add CICD examples HOT 1
- Add support for ambiorix framework HOT 1
- Explore multi-arch images
- Update to of-watchdog 0.8.4 HOT 2
- r-minimal build dependencies HOT 1
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 openfaas-rstats-templates.