-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into post_body_content_type
* master: Update Docker files (#589)
- Loading branch information
Showing
9 changed files
with
111 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
schedule: | ||
- cron: '0 0 1 * *' # first of every month | ||
|
||
|
||
jobs: | ||
docker: | ||
name: ${{ matrix.config.tags }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
r_version: | ||
- "latest" | ||
|
||
config: | ||
- name: CRAN | ||
# always overwrite the latest version with the CRAN version | ||
tags: "v0.4.6,latest" | ||
ref: "v0.4.6" | ||
|
||
- name: GitHub | ||
# 'next' tag signifies the _next_ release | ||
tags: "next" | ||
ref: "master" | ||
|
||
|
||
steps: | ||
- uses: actions/checkout@master | ||
|
||
# https://github.com/marketplace/actions/publish-docker | ||
- name: rstudio/plumber | ||
uses: elgohr/Publish-Docker-Github-Action@2.18 | ||
with: | ||
name: rstudio/plumber | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
cache: false | ||
workdir: "." | ||
buildargs: "R_VERSION=${{ matrix.r_version }},PLUMBER_REF=${{ matrix.config.ref }}${{ matrix.config.extra_buildargs }}" | ||
tags: ${{ matrix.config.tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,60 @@ | ||
FROM rocker/r-base | ||
MAINTAINER Jeff Allen <docker@trestletech.com> | ||
|
||
RUN apt-get update -qq && apt-get install -y \ | ||
ARG R_VERSION=latest | ||
|
||
FROM rocker/r-ver:${R_VERSION} | ||
LABEL maintainer="barret@rstudio.com" | ||
|
||
ARG PLUMBER_REF=master | ||
|
||
# BEGIN rstudio/plumber layers | ||
RUN apt-get update -qq && apt-get install -y --no-install-recommends \ | ||
git-core \ | ||
libssl-dev \ | ||
libcurl4-gnutls-dev \ | ||
libsodium-dev | ||
curl \ | ||
libsodium-dev \ | ||
libxml2-dev | ||
|
||
RUN install2.r remotes | ||
|
||
## RUN R -e 'install.packages(c("remotes"))' | ||
## RUN R -e 'remotes::install_github("rstudio/plumber")' | ||
RUN install2.r plumber | ||
## Remove this comment to always bust the Docker cache at this step | ||
## https://stackoverflow.com/a/55621942/591574 | ||
#ADD https://github.com/rstudio/plumber/commits/ _docker_cache | ||
|
||
RUN Rscript -e "remotes::install_github('rstudio/plumber@${PLUMBER_REF}')" | ||
|
||
EXPOSE 8000 | ||
ENTRYPOINT ["R", "-e", "pr <- plumber::plumb(commandArgs()[4]); pr$run(host='0.0.0.0', port=8000)"] | ||
|
||
ENTRYPOINT ["R", "-e", "pr <- plumber::plumb(rev(commandArgs())[1]); pr$run(host='0.0.0.0', port=8000, swagger=TRUE)"] | ||
|
||
CMD ["/usr/local/lib/R/site-library/plumber/examples/04-mean-sum/plumber.R"] | ||
|
||
# EOF rstudio/plumber layers | ||
|
||
# README: | ||
|
||
# Usage (adjust the tags/versions according to your preferences): | ||
|
||
# build docker file | ||
# docker build --build-arg R_VERSION=4.0.2 -t rstudio/plumber:latest . | ||
# run with defaults | ||
# docker run -it -p 8000:8000 --rm --name plumber rstudio/plumber:latest | ||
# open in browser | ||
# firefox http://localhost:8000/__swagger__/ & | ||
|
||
# to run with your own api - mount your plumber.R file into the container like so: | ||
# docker run -it -p 8000:8000 --rm -v ~/R/x86_64-pc-linux-gnu-library/4.0/plumber/examples/10-welcome/plumber.R:/api/plumber.R:ro --name myapi rstudio/plumber:latest /api/plumber.R | ||
# then browse with | ||
# curl http://localhost:8000/ | ||
|
||
|
||
# Extend the rstudio/plumber:TAG Dockerfile / build your own custom image adding debian packages and your own api: | ||
|
||
## ./Dockerfile | ||
# FROM rstudio/plumber:latest | ||
# RUN apt-get update -qq && apt-get install -y \ | ||
# [list-your-debian-packages-here] | ||
# # add app files from host's present working dir | ||
# COPY . /api | ||
# # set default startup command to run the app's "plumber.R" file | ||
# CMD ["/api/plumber.R"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
FROM trestletech/plumber | ||
MAINTAINER Jeff Allen <docker@trestletech.com> | ||
FROM rstudio/plumber:next | ||
|
||
COPY github-key.txt /github-key | ||
|
||
CMD ["/examples/03-github/github.R"] | ||
CMD ["/usr/local/lib/R/site-library/plumber/examples/03-github/plumber.R"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
FROM trestletech/plumber | ||
MAINTAINER Jeff Allen <docker@trestletech.com> | ||
FROM rstudio/plumber:next | ||
|
||
ENTRYPOINT R -e "pr <- plumber::plumb('/examples/06-sessions/sessions.R'); pr\$registerHooks(plumber::sessionCookie('secret', 'cookieName', path='/')); pr\$run(host='0.0.0.0', port=8000)" | ||
ENTRYPOINT R \ | ||
-e "pr <- plumber::plumb(system.file('examples/06-sessions/plumber.R', package = 'plumber'))" \ | ||
-e "pr\$registerHooks(plumber::sessionCookie('pleasechangeme', 'cookieName'))" \ | ||
-e "pr\$run(host='0.0.0.0', port=8000)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
FROM trestletech/plumber | ||
MAINTAINER Jeff Allen <docker@trestletech.com> | ||
FROM rstudio/plumber:next | ||
|
||
RUN R -e "install.packages('htmltools')" | ||
|
||
CMD ["/examples/07-mailgun/mailgun.R"] | ||
CMD ["/usr/local/lib/R/site-library/plumber/examples/07-mailgun/plumber.R"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters