# Builder image
FROM --platform=linux/amd64 golang:1.21 as builder

WORKDIR /src

COPY go.mod go.sum ./
RUN go mod download

COPY . .
RUN go build -mod=readonly -v -o pactual-backend main.go

# Runtime image
FROM --platform=linux/amd64 golang:1.21

WORKDIR /app

COPY --from=builder /src/pactual-backend .
CMD ["/app/pactual-backend"]
