go versie

This commit is contained in:
2020-03-25 11:20:14 +01:00
parent ce771881ab
commit 2e7f52ea47
10 changed files with 55 additions and 28 deletions

BIN
.DS_Store vendored

Binary file not shown.

2
src/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,2 @@
# Default ignored files
/workspace.xml

6
src/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

8
src/.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/src.iml" filepath="$PROJECT_DIR$/.idea/src.iml" />
</modules>
</component>
</project>

9
src/.idea/src.iml generated Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
src/.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@@ -1,17 +0,0 @@
from flask import Flask
from flask import jsonify
app = Flask(__name__)
@app.route('/')
def doRequest():
data = {
"serverName": "backend-server",
"version": "experimental",
"success": "true"
}
return jsonify(data)
if __name__ == '__main__':
app.run(debug=True, host="0.0.0.0", port=80)

View File

@@ -1,10 +1,9 @@
from python:3.7-alpine
copy . /app
workdir /app
run pip install -r requirements.txt
expose 80
entrypoint [ "python" ]
cmd [ "app.py" ]
FROM golang:alpine as builder
RUN mkdir /build
COPY main.go /build/main.go
WORKDIR /build
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o main .
FROM scratch
COPY --from=builder /build/main /main
EXPOSE 80
CMD ["./main"]

15
src/main.go Normal file
View File

@@ -0,0 +1,15 @@
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", HelloServer)
http.ListenAndServe(":80", nil)
}
func HelloServer(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "{\"serverName\":\"backend-server\",\"success:false\",\"version\": \"experimental\"}")
}

View File

@@ -1 +0,0 @@
Flask