kickstart
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
FROM golang:1.25.2-alpine3.22 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod ./
|
||||
COPY server/ ./server/
|
||||
|
||||
RUN go mod download
|
||||
RUN go build -o /app/service_b ./server/main.go
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/service_b /app/service_b
|
||||
|
||||
EXPOSE 8090
|
||||
|
||||
CMD ["/app/service_b"]
|
||||
@@ -0,0 +1,3 @@
|
||||
module serviceb
|
||||
|
||||
go 1.25.2
|
||||
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.HandleFunc("GET /hello", func(w http.ResponseWriter, r *http.Request) {
|
||||
log.Println("Received request on /hello endpoint")
|
||||
fmt.Fprintf(w, "Hello world from service B")
|
||||
})
|
||||
|
||||
http.ListenAndServe(":8090", mux)
|
||||
}
|
||||
Reference in New Issue
Block a user