Dhruv Diddi commited on
Commit
5ed7f7b
1 Parent(s): 655cf6b

feat: consider go server

Browse files
Files changed (3) hide show
  1. Dockerfile +8 -6
  2. main.go +18 -0
  3. main.py +0 -7
Dockerfile CHANGED
@@ -1,11 +1,13 @@
1
- FROM python:3.9
2
 
3
- WORKDIR /code
4
 
5
- COPY ./requirements.txt /code/requirements.txt
6
 
7
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
 
9
- COPY . .
 
10
 
11
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
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!"}