-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from m-muecke/examples/plumber
refactor: update plumber example
- Loading branch information
Showing
2 changed files
with
22 additions
and
11 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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
|
||
FROM rhub/r-minimal | ||
|
||
RUN apk add --no-cache --update-cache \ | ||
--repository http://nl.alpinelinux.org/alpine/v3.11/main \ | ||
autoconf=2.69-r2 \ | ||
automake=1.16.1-r0 && \ | ||
# repeat autoconf and automake (under `-t`) | ||
# to (auto)remove them after installation | ||
installr -d \ | ||
-t "libsodium-dev curl-dev linux-headers autoconf automake" \ | ||
-a libsodium \ | ||
plumber | ||
RUN installr -d \ | ||
-t "libsodium-dev curl-dev linux-headers" \ | ||
-a libsodium \ | ||
plumber | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
EXPOSE 8000 | ||
|
||
ENTRYPOINT ["R", "-e", "pr <- plumber::plumb('plumber.R'); 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#* @get /mean | ||
function(samples = 10) { | ||
data <- rnorm(samples) | ||
mean(data) | ||
} | ||
|
||
#* @post /sum | ||
function(a, b) { | ||
as.numeric(a) + as.numeric(b) | ||
} |