Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cd4c129
Showing
6 changed files
with
135 additions
and
0 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,13 @@ | ||
# BUILD | ||
FROM hrkt/command-as-a-service:latest as build-stage | ||
|
||
# Production | ||
FROM ubuntu:19.10 as production-stage | ||
RUN apt-get update && apt-get install -y \ | ||
musl-dev \ | ||
pandoc | ||
COPY --from=build-stage /command-as-a-service . | ||
COPY app-settings.json . | ||
EXPOSE 8080 | ||
CMD ["./command-as-a-service"] | ||
|
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 Hiroki Ito | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,17 @@ | ||
NAME :=pandoc-as-a-service | ||
LABEL :=pandoc-as-a-service:0.1.0 | ||
|
||
# container | ||
|
||
build-container: | ||
sudo docker build -t $(LABEL) . | ||
|
||
run-container: | ||
sudo docker run -p 8080:8080 $(LABEL) | ||
|
||
clean-container: | ||
sudo docker image prune | ||
sudo docker container prune | ||
|
||
check-container: | ||
curl http://localhost:8080/bin/date |
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,46 @@ | ||
# pandoc-as-a-service | ||
|
||
## It does... | ||
|
||
pandoc-as-a-service executes the command with options specified in the url, with STDIN from HTTP request body, and returns STDOUT in HTTP response body. | ||
|
||
## It does not... | ||
|
||
- authenticate request | ||
- limit rate | ||
|
||
## future work | ||
|
||
see GitHub project : https://github.com/hrkt/command-as-a-service/projects | ||
|
||
# How to run | ||
|
||
1. execute server. | ||
|
||
``` | ||
$ docker run -p 8080:8080 hrkt/pandoc-as-a-service | ||
``` | ||
|
||
2. make HTTP POST request | ||
|
||
``` | ||
$ curl "http://localhost:8080/usr/bin/pandoc?-f&markdown&-t&html" --dat-binary @testdata/sample.md | ||
``` | ||
|
||
# dev how-to | ||
|
||
## build container | ||
|
||
``` | ||
$ make build-container | ||
``` | ||
|
||
## run container | ||
|
||
``` | ||
$ make run-container | ||
``` | ||
|
||
# License | ||
MIT | ||
|
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,27 @@ | ||
{ | ||
"dangerousMode": false, | ||
"port": 8080, | ||
"whitelist": [ | ||
"/bin/date", | ||
"/bin/echo", | ||
"/bin/hostname", | ||
"/bin/sleep", | ||
"/usr/bin/bc", | ||
"/usr/bin/cal", | ||
"/usr/bin/diff", | ||
"/usr/bin/egrep", | ||
"/usr/bin/grep", | ||
"/usr/bin/gzcat", | ||
"/usr/bin/head", | ||
"/usr/bin/iconv", | ||
"/usr/bin/man", | ||
"/usr/bin/od", | ||
"/usr/bin/sed", | ||
"/usr/bin/seq", | ||
"/usr/bin/sort", | ||
"/usr/bin/tail", | ||
"/usr/bin/tr", | ||
"/usr/bin/wc", | ||
"/usr/bin/pandoc" | ||
] | ||
} |
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,11 @@ | ||
# Level1 | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | ||
|
||
## Level2 | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | ||
|
||
### Level3 | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |