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_a ./server/main.go
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/service_a /app/service_a
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["/app/service_a"]
|
||||
@@ -0,0 +1,3 @@
|
||||
module servicea
|
||||
|
||||
go 1.25.2
|
||||
@@ -0,0 +1,19 @@
|
||||
create table public.locations
|
||||
(
|
||||
id serial primary key,
|
||||
location_name varchar(255) not null
|
||||
);
|
||||
|
||||
|
||||
create table public.temp_data
|
||||
(
|
||||
id serial primary key,
|
||||
|
||||
location_id int not null references public.locations (id),
|
||||
max_temp float not null,
|
||||
min_temp float not null,
|
||||
rainfall float not null,
|
||||
cloudiness float not null,
|
||||
|
||||
created_at timestamp not null default now()
|
||||
);
|
||||
@@ -0,0 +1,2 @@
|
||||
-- name: DummyQuery :exec
|
||||
select 1;
|
||||
@@ -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 A")
|
||||
})
|
||||
|
||||
http.ListenAndServe(":8080", mux)
|
||||
}
|
||||
Reference in New Issue
Block a user