2
0
Mohammed Nafees 4 жил өмнө
parent
commit
28bc0c885b

+ 8 - 0
services/cli_install_script_container/Dockerfile

@@ -0,0 +1,8 @@
+FROM golang:1.17.6-alpine3.14
+
+WORKDIR /app
+COPY . .
+
+RUN go build -o serve main.go
+
+ENTRYPOINT [ "./serve" ]

+ 0 - 0
install.sh → services/cli_install_script_container/install.sh


+ 29 - 0
services/cli_install_script_container/main.go

@@ -0,0 +1,29 @@
+package main
+
+import (
+	"fmt"
+	"io/ioutil"
+	"net/http"
+	"os"
+)
+
+func serve(w http.ResponseWriter, req *http.Request) {
+	contents, err := ioutil.ReadFile("install.sh")
+	if err != nil {
+		w.WriteHeader(http.StatusInternalServerError)
+		return
+	}
+	w.WriteHeader(http.StatusOK)
+	w.Header().Add("Content-Type", "text/plain")
+	w.Write(contents)
+}
+
+func main() {
+	var port string
+	if port = os.Getenv("PORT"); port == "" {
+		port = "80"
+	}
+
+	http.HandleFunc("/", serve)
+	http.ListenAndServe(fmt.Sprintf(":%s", port), nil)
+}