about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rest-api/Dockerfile11
-rwxr-xr-xsrc/rest-api/build-and-push-to-registry.sh1
-rw-r--r--src/rest-api/cmd/main.go11
3 files changed, 21 insertions, 2 deletions
diff --git a/src/rest-api/Dockerfile b/src/rest-api/Dockerfile
new file mode 100644
index 0000000..b8eccf0
--- /dev/null
+++ b/src/rest-api/Dockerfile
@@ -0,0 +1,11 @@
+FROM golang
+
+WORKDIR /app
+
+COPY . /app
+
+RUN go build cmd/main.go
+
+EXPOSE 8080
+
+CMD ["/app/main"]
diff --git a/src/rest-api/build-and-push-to-registry.sh b/src/rest-api/build-and-push-to-registry.sh
new file mode 100755
index 0000000..a132b7d
--- /dev/null
+++ b/src/rest-api/build-and-push-to-registry.sh
@@ -0,0 +1 @@
+docker buildx build -t docker.io/baitinq/fs-tracer:$(git rev-parse --short HEAD) --push .
diff --git a/src/rest-api/cmd/main.go b/src/rest-api/cmd/main.go
index 94fb4bc..bfeb752 100644
--- a/src/rest-api/cmd/main.go
+++ b/src/rest-api/cmd/main.go
@@ -1,7 +1,14 @@
 package main
 
-import "fmt"
+import (
+	"fmt"
+	"net/http"
+)
 
 func main() {
-  fmt.Println("Hi!")
+  http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
+  fmt.Fprint(w, "Hello, World!")
+ })
+
+  http.ListenAndServe(":8080", nil)
 }