diff --git a/.DS_Store b/.DS_Store index 3147abc..71475cd 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/src/.idea/.gitignore b/src/.idea/.gitignore new file mode 100644 index 0000000..e7e9d11 --- /dev/null +++ b/src/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml diff --git a/src/.idea/misc.xml b/src/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/src/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/src/.idea/modules.xml b/src/.idea/modules.xml new file mode 100644 index 0000000..f669a0e --- /dev/null +++ b/src/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/.idea/src.iml b/src/.idea/src.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/src/.idea/src.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/.idea/vcs.xml b/src/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/src/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/app.py b/src/app.py deleted file mode 100644 index 17c58a2..0000000 --- a/src/app.py +++ /dev/null @@ -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) diff --git a/src/dockerfile b/src/dockerfile index e9ef308..5bb9295 100644 --- a/src/dockerfile +++ b/src/dockerfile @@ -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"] \ No newline at end of file diff --git a/src/main.go b/src/main.go new file mode 100644 index 0000000..e10e4c6 --- /dev/null +++ b/src/main.go @@ -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\"}") +} \ No newline at end of file diff --git a/src/requirements.txt b/src/requirements.txt deleted file mode 100644 index 2077213..0000000 --- a/src/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -Flask \ No newline at end of file