more tries
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Pedro Pérez 2025-05-29 23:23:19 +02:00
parent 3232cd985c
commit e9b13d317a
5 changed files with 24 additions and 9 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
tmp/

View File

@ -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
- docker build -t learndrone:latest .
# - name: deploy
# image: docker:26.0.0
# commands:
# - docker-compose up -d

View File

@ -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

View File

@ -0,0 +1,5 @@
services:
core:
image: learndrone:latest
ports:
- 8090:8080

View File

@ -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)