mirror of
https://github.com/bvanroll/stage-backend.git
synced 2025-08-29 20:12:46 +00:00
go versie
This commit is contained in:
2
src/.idea/.gitignore
generated
vendored
Normal file
2
src/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Default ignored files
|
||||
/workspace.xml
|
6
src/.idea/misc.xml
generated
Normal file
6
src/.idea/misc.xml
generated
Normal 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
8
src/.idea/modules.xml
generated
Normal 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
9
src/.idea/src.iml
generated
Normal 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
6
src/.idea/vcs.xml
generated
Normal 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>
|
17
src/app.py
17
src/app.py
@@ -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)
|
@@ -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
15
src/main.go
Normal 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\"}")
|
||||
}
|
@@ -1 +0,0 @@
|
||||
Flask
|
Reference in New Issue
Block a user