Merge branch 'master' of https://github.com/metrue/fx into fixalldown
This commit is contained in:
@@ -51,6 +51,7 @@ jobs:
|
||||
fx up examples/functions/func.php >> deploy.log
|
||||
fx up examples/functions/func.jl >> deploy.log
|
||||
fx up examples/functions/func.java >> deploy.log
|
||||
fx up examples/functions/func.d >> deploy.log
|
||||
cat server_output.log
|
||||
cat deploy.log;
|
||||
cat deploy.log | grep '\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-' | wc -l | grep 14
|
||||
|
||||
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
assets/* linguist-vendored
|
||||
*.md linguist-documentation
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,4 +6,5 @@ build/
|
||||
*.swp
|
||||
/fx
|
||||
tmp/
|
||||
/api/google
|
||||
/coverage.txt
|
||||
|
||||
10
Makefile
10
Makefile
@@ -2,23 +2,27 @@ OUTPUT_DIR=./build
|
||||
DIST_DIR=./dist
|
||||
|
||||
install-deps:
|
||||
# install protoc
|
||||
./bin/install_protoc.sh
|
||||
|
||||
# install protobuf and grpc
|
||||
go get -u github.com/golang/protobuf/protoc-gen-go
|
||||
go get -u github.com/golang/protobuf/protoc-gen-go
|
||||
go get -u google.golang.org/grpc
|
||||
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
|
||||
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
|
||||
go get -u github.com/jteeuwen/go-bindata/...
|
||||
|
||||
git clone --depth 1 https://github.com/googleapis/googleapis.git vendor/github.com/googleapis
|
||||
cp -rf vendor/github.com/googleapis/google/ api/google/
|
||||
|
||||
# install protoc
|
||||
./bin/install_protoc.sh
|
||||
|
||||
# install the other dependencies
|
||||
@dep ensure
|
||||
generate:
|
||||
# generate gRPC related code
|
||||
go generate ./api/fx.go
|
||||
# bundle assert into binary
|
||||
go-bindata -pkg common -o common/asset.go ./assets/dockerfiles/fx/...
|
||||
build: generate
|
||||
go build -o ${OUTPUT_DIR}/fx fx.go
|
||||
cross:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
1. Prepare your Dockerfile within this [directory](https://github.com/metrue/fx/tree/master/assets/dockerfiles/fx). you can simply test it:
|
||||
|
||||
```
|
||||
docker -t <foo-bar> build .
|
||||
docker run foo-bar
|
||||
docker build -t <foo-bar> .
|
||||
docker run -p 3000:3000 foo-bar
|
||||
```
|
||||
if everything works as you expected, fx will support it without any extra effort.
|
||||
|
||||
|
||||
@@ -204,6 +204,9 @@ Thank you to all the people who already contributed to fx!
|
||||
<a href="https://github.com/pplam" target="_blank">
|
||||
<img alt="pplam" src="https://avatars2.githubusercontent.com/u/12783579?v=4&s=50" width="50">
|
||||
</a>
|
||||
<a href="https://github.com/muka" target="_blank">
|
||||
<img alt="muka" src="https://avatars2.githubusercontent.com/u/1021269?v=4&s=50 width="50">
|
||||
</a>
|
||||
<a href="https://github.com/xwjdsh" target="_blank">
|
||||
<img alt="xwjdsh" src="https://avatars2.githubusercontent.com/u/11025519?v=4&s=50" width="50">
|
||||
</a>
|
||||
@@ -219,6 +222,9 @@ Thank you to all the people who already contributed to fx!
|
||||
<a href="https://github.com/chlins" target="_blank">
|
||||
<img alt="chlins" src="https://avatars2.githubusercontent.com/u/31262637?v=4&s=50" width="50">
|
||||
</a>
|
||||
<a href="https://github.com/andre2007" target="_blank">
|
||||
<img alt="andre2007" src="https://avatars1.githubusercontent.com/u/1451047?s=50&v=4" width="50">
|
||||
</a>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
5
assets/dockerfiles/base/d/Dockerfile
Normal file
5
assets/dockerfiles/base/d/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y build-essential curl libcurl3 \
|
||||
&& curl -OL http://downloads.dlang.org/releases/2.x/2.077.1/dmd_2.077.1-0_amd64.deb \
|
||||
&& apt install ./dmd_2.077.1-0_amd64.deb
|
||||
5
assets/dockerfiles/fx/d/Dockerfile
Normal file
5
assets/dockerfiles/fx/d/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM metrue/fx-d-base
|
||||
|
||||
COPY . .
|
||||
EXPOSE 3000
|
||||
CMD ["rdmd", "-version=embedded_httpd", "app", "--port", "3000"]
|
||||
16
assets/dockerfiles/fx/d/app.d
Normal file
16
assets/dockerfiles/fx/d/app.d
Normal file
@@ -0,0 +1,16 @@
|
||||
import std.json;
|
||||
import arsd.cgi;
|
||||
import fx;
|
||||
|
||||
void handle(Cgi cgi)
|
||||
{
|
||||
if (cgi.requestMethod == Cgi.RequestMethod.POST && cgi.pathInfo == "/")
|
||||
{
|
||||
auto input = parseJSON(cgi.postJson);
|
||||
auto result = JSONValue(executeFx(input));
|
||||
cgi.setResponseContentType("application/json");
|
||||
cgi.write(toJSON(result));
|
||||
}
|
||||
}
|
||||
|
||||
mixin GenericMain!handle;
|
||||
4071
assets/dockerfiles/fx/d/arsd/cgi.d
Normal file
4071
assets/dockerfiles/fx/d/arsd/cgi.d
Normal file
File diff suppressed because it is too large
Load Diff
6
assets/dockerfiles/fx/d/fx.d
Normal file
6
assets/dockerfiles/fx/d/fx.d
Normal file
@@ -0,0 +1,6 @@
|
||||
import std.json;
|
||||
|
||||
long executeFx(JSONValue input)
|
||||
{
|
||||
return input["a"].integer + input["b"].integer;
|
||||
}
|
||||
473
common/asset.go
473
common/asset.go
File diff suppressed because one or more lines are too long
1
env/env.go
vendored
1
env/env.go
vendored
@@ -9,6 +9,7 @@ func PullBaseDockerImage(verbose bool) {
|
||||
"metrue/fx-julia-base",
|
||||
"metrue/fx-python-base",
|
||||
"metrue/fx-node-base",
|
||||
"metrue/fx-d-base",
|
||||
}
|
||||
|
||||
task := func(image string, verbose bool) {
|
||||
|
||||
6
examples/functions/func.d
Normal file
6
examples/functions/func.d
Normal file
@@ -0,0 +1,6 @@
|
||||
import std.json;
|
||||
|
||||
long executeFx(JSONValue input)
|
||||
{
|
||||
return input["a"].integer + input["b"].integer;
|
||||
}
|
||||
@@ -18,6 +18,7 @@ var funcNames = map[string]string{
|
||||
"php": "/fx.php",
|
||||
"julia": "/fx.jl",
|
||||
"java": "/src/main/java/fx/Fx.java",
|
||||
"d": "/fx.d",
|
||||
}
|
||||
|
||||
var assetsMap = map[string][]string{
|
||||
@@ -59,6 +60,12 @@ var assetsMap = map[string][]string{
|
||||
"assets/dockerfiles/fx/ruby/app.rb",
|
||||
"assets/dockerfiles/fx/ruby/fx.rb",
|
||||
},
|
||||
"d": {
|
||||
"assets/dockerfiles/fx/d/Dockerfile",
|
||||
"assets/dockerfiles/fx/d/app.d",
|
||||
"assets/dockerfiles/fx/d/fx.d",
|
||||
"assets/dockerfiles/fx/d/arsd/cgi.d",
|
||||
},
|
||||
}
|
||||
|
||||
func removePrefix(lang string, filename string) (name string) {
|
||||
|
||||
@@ -282,6 +282,7 @@ func GetLangFromFileName(fileName string) (lang string) {
|
||||
".php": "php",
|
||||
".jl": "julia",
|
||||
".java": "java",
|
||||
".d": "d",
|
||||
}
|
||||
return extLangMap[filepath.Ext(fileName)]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user