FROM golang:1.19-bullseye as builder
MAINTAINER restitux <restitux@ohea.xyz>

# Install connect proto build deps
RUN go install github.com/bufbuild/buf/cmd/buf@latest && \
    go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest && \
    go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
    go install github.com/bufbuild/connect-go/cmd/protoc-gen-connect-go@latest

COPY . /server
WORKDIR /server
RUN go build .


FROM debian:bullseye
RUN apt-get update && apt-get install -y \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*
COPY --from=builder /server/server /server
ENTRYPOINT ["/server"]
