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:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: debian
|
image: golang:1.24
|
||||||
commands:
|
commands:
|
||||||
- echo "This is the build step"
|
- mkdir -p tmp
|
||||||
- echo "binary-data-123-456" > executable
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./tmp/learndrone ./main.go
|
||||||
- name: a-test-step
|
- name: docker-build
|
||||||
image: golang:1.16
|
image: docker:26.0.0
|
||||||
commands:
|
commands:
|
||||||
- echo "Testing ..."
|
- docker build -t learndrone:latest .
|
||||||
- ./executable
|
# - 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:
|
build-linux:
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./tmp/learndrone ./main.go
|
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"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
version = "v1.0.0"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
|
|
||||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
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) {
|
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)
|
http.ListenAndServe(":8080", mux)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user