initial commit
commit
18be049f05
@ -0,0 +1,11 @@
|
||||
FROM golang:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download && go mod verify
|
||||
|
||||
COPY . .
|
||||
RUN go build -v -o ./bin/server .
|
||||
|
||||
CMD ["./bin/server"]
|
@ -0,0 +1,9 @@
|
||||
version: '3'
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "127.14.115.95:1091:4000"
|
||||
restart: unless-stopped
|
@ -0,0 +1,3 @@
|
||||
module git.phc.dm.unipi.it/phc/portainer-example
|
||||
|
||||
go 1.21.1
|
@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"mime"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
r := http.NewServeMux()
|
||||
r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodGet {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", mime.TypeByExtension(".json"))
|
||||
if err := json.NewEncoder(w).Encode("ok"); err != nil {
|
||||
log.Fatal(err)
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
log.Fatal(http.ListenAndServe(":4000", r))
|
||||
}
|
Loading…
Reference in New Issue