From e9b13d317a34ccfc5959402391dd9a019f37befc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20P=C3=A9rez?= Date: Thu, 29 May 2025 23:23:19 +0200 Subject: [PATCH] more tries --- .gitignore | 1 + .woodpecker.yml | 17 ++++++++++------- Makefile | 2 ++ docker-compose.yml | 5 +++++ main.go | 8 ++++++-- 5 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c036379 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tmp/ \ No newline at end of file diff --git a/.woodpecker.yml b/.woodpecker.yml index b1c24ba..78f826f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -4,12 +4,15 @@ when: steps: - name: build - image: debian + image: golang:1.24 commands: - - echo "This is the build step" - - echo "binary-data-123-456" > executable - - name: a-test-step - image: golang:1.16 + - mkdir -p tmp + - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./tmp/learndrone ./main.go + - name: docker-build + image: docker:26.0.0 commands: - - echo "Testing ..." - - ./executable \ No newline at end of file + - docker build -t learndrone:latest . + # - name: deploy + # image: docker:26.0.0 + # commands: + # - docker-compose up -d \ No newline at end of file diff --git a/Makefile b/Makefile index 159ba18..e9054ac 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +version := $(shell grep 'version =' main.go | cut -d'"' -f2) + build-linux: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./tmp/learndrone ./main.go diff --git a/docker-compose.yml b/docker-compose.yml index e69de29..426cfe3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +services: + core: + image: learndrone:latest + ports: + - 8090:8080 \ No newline at end of file diff --git a/main.go b/main.go index 95b8f10..c3af987 100644 --- a/main.go +++ b/main.go @@ -5,14 +5,18 @@ import ( "net/http" ) +const ( + version = "v1.0.0" +) + func main() { mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("Hello, World!")) + w.Write([]byte("Hello, World page")) }) mux.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode(map[string]string{"message": "Hello, World!"}) + json.NewEncoder(w).Encode(map[string]string{"message": "hello world json!"}) }) http.ListenAndServe(":8080", mux)