Spaces:
Runtime error
Runtime error
Dhruv Diddi
commited on
Commit
·
5ed7f7b
1
Parent(s):
655cf6b
feat: consider go server
Browse files- Dockerfile +8 -6
- main.go +18 -0
- main.py +0 -7
Dockerfile
CHANGED
|
@@ -1,11 +1,13 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
-
WORKDIR /
|
| 4 |
|
| 5 |
-
COPY
|
| 6 |
|
| 7 |
-
RUN
|
| 8 |
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
| 1 |
+
FROM golang:1.18 as builder
|
| 2 |
|
| 3 |
+
WORKDIR /workdir
|
| 4 |
|
| 5 |
+
COPY main.go .
|
| 6 |
|
| 7 |
+
RUN go build -o main main.go
|
| 8 |
|
| 9 |
+
FROM golang:1.18
|
| 10 |
+
WORKDIR /workdir
|
| 11 |
|
| 12 |
+
COPY --from=builder /workdir/main /main
|
| 13 |
+
CMD /main
|
main.go
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package main
|
| 2 |
+
|
| 3 |
+
import (
|
| 4 |
+
//"fmt"
|
| 5 |
+
"net/http"
|
| 6 |
+
//"net/url"
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
func main() {
|
| 10 |
+
http.HandleFunc("/", HelloServer)
|
| 11 |
+
http.ListenAndServe(":8080", nil)
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
func HelloServer(w http.ResponseWriter, r *http.Request) {
|
| 15 |
+
//m, _ := url.ParseQuery(r.URL.RawQuery)
|
| 16 |
+
//fmt.Fprintf(w, "Hello, %s!", m["q"])
|
| 17 |
+
http.Redirect(w, r, "https://deepfloyd-if.hf.space/", http.StatusSeeOther)
|
| 18 |
+
}
|
main.py
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
from fastapi import FastAPI
|
| 2 |
-
|
| 3 |
-
app = FastAPI()
|
| 4 |
-
|
| 5 |
-
@app.get("/")
|
| 6 |
-
def read_root():
|
| 7 |
-
return {"Hello": "World!"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|