diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8c514e7 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +PROTOC_GEN_GO := protoc-gen-go +PROTOC_GEN_GO_GRPC := protoc-gen-go-grpc +PROTO_DIR := pkg/pb +PROTO_FILE := $(PROTO_DIR)/data_service/data.proto +OUT_DIR := $(PROTO_DIR) + +.PHONY: proto +proto: + @echo "Generating Go code from Protobuf..." + protoc \ + --go_out=$(OUT_DIR) --go_opt=paths=source_relative \ + --go-grpc_out=$(OUT_DIR) --go-grpc_opt=paths=source_relative \ + $(PROTO_FILE) + @echo "Protobuf generation complete." diff --git a/services/data_service/Dockerfile b/services/data_service/Dockerfile new file mode 100644 index 0000000..8b834d0 --- /dev/null +++ b/services/data_service/Dockerfile @@ -0,0 +1,25 @@ +# Stage 1: Builder +FROM golang:latest AS builder + +WORKDIR /app + +# Copy go mod and download deps +COPY go.mod go.sum ./ +RUN go mod download + +# Copy source +COPY . . + +# Build binary +RUN CGO_ENABLED=0 GOOS=linux go build -o /data_service ./services/data_service/cmd + +# Stage 2: Runner +FROM debian:bullseye-slim + +# Minimal setup +RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* + +# Copy binary +COPY --from=builder /data_service /usr/local/bin/data_service + +ENTRYPOINT ["data_service"]