Afranco commited on
Commit
40913a3
1 Parent(s): 029eb9f

init: first commit, framing repo

Browse files

On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
new file: Dockerfile
new file: main.go

Files changed (2) hide show
  1. Dockerfile +13 -0
  2. main.go +19 -0
Dockerfile ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <F24><F25>
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,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
15
+ func HelloServer(w http.ResponseWriter, r *http.Request) {
16
+ m, _ := url.ParseQuery(r.URL.RawQuery)
17
+ fmt.Fprintf(w, "Hello, %s!", m["q"])
18
+
19
+ }