initial commit

This commit is contained in:
Pedro Pérez 2025-05-29 14:52:06 +02:00
commit 113ac95610
4 changed files with 32 additions and 0 deletions

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM alpine:3.21
WORKDIR /app
COPY ./tmp/learndrone /app/learndrone
CMD ["/app/learndrone"]

6
Makefile Normal file
View File

@ -0,0 +1,6 @@
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./tmp/learndrone ./main.go
pack-docker:
make build-linux
docker build -t learndrone:${version} -t learndrone:latest .

0
docker-compose.yml Normal file
View File

19
main.go Normal file
View File

@ -0,0 +1,19 @@
package main
import (
"encoding/json"
"net/http"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello, World!"))
})
mux.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(map[string]string{"message": "Hello, World!"})
})
http.ListenAndServe(":8080", mux)
}