Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be9472a53c | ||
|
|
f895b2151f | ||
|
|
7af6a9b311 | ||
|
|
dbefe38dd6 |
@@ -44,9 +44,10 @@ jobs:
|
||||
fx up examples/functions/func.go >> deploy.log
|
||||
fx up examples/functions/func.php >> deploy.log
|
||||
fx up examples/functions/func.jl >> deploy.log
|
||||
fx up examples/functions/func.R >> deploy.log
|
||||
cat server_output.log
|
||||
cat deploy.log;
|
||||
cat deploy.log | grep 'Succed: 1' | wc -l | grep 6
|
||||
cat deploy.log | grep 'Succed: 1' | wc -l | grep 7
|
||||
|
||||
deployment:
|
||||
production:
|
||||
|
||||
9
images/R/Dockerfile
Normal file
9
images/R/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM r-base
|
||||
|
||||
COPY . /usr/local/src/fx
|
||||
WORKDIR /usr/local/src/fx
|
||||
RUN R -f packages.R
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["Rscript", "app.R"]
|
||||
11
images/R/app.R
Normal file
11
images/R/app.R
Normal file
@@ -0,0 +1,11 @@
|
||||
library(jug)
|
||||
library(jsonlite)
|
||||
source('./fx.R')
|
||||
|
||||
jug() %>%
|
||||
post("/", function(req, res, err) {
|
||||
input <- fromJSON(req$body)
|
||||
fx(input)
|
||||
}) %>%
|
||||
simple_error_handler_json() %>%
|
||||
serve_it(port = 3000)
|
||||
3
images/R/fx.R
Normal file
3
images/R/fx.R
Normal file
@@ -0,0 +1,3 @@
|
||||
fx <- function(input) {
|
||||
return (strtoi(input$a) + strtoi(input$b))
|
||||
}
|
||||
1
images/R/packages.R
Normal file
1
images/R/packages.R
Normal file
@@ -0,0 +1 @@
|
||||
install.packages(c("jug", "jsonlite"), repos="http://cran.us.r-project.org", dependencies=TRUE)
|
||||
Reference in New Issue
Block a user