This commit is contained in:
parent
3232cd985c
commit
e9b13d317a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
tmp/
|
||||
@ -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
|
||||
2
Makefile
2
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
|
||||
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
services:
|
||||
core:
|
||||
image: learndrone:latest
|
||||
ports:
|
||||
- 8090:8080
|
||||
8
main.go
8
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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user