# Use the official Go image as a parent image FROM golang:1.22 as builder # Set the working directory inside the container WORKDIR /app # Copy the go.mod and go.sum files COPY go.* ./ # Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed RUN go mod download # Copy the source code into the container COPY . . # Build the application RUN CGO_ENABLED=0 GOOS=linux go build -v -o btcpaychecker cmd/btcpaychecker/main.go # Use the alpine image for a smaller footprint FROM alpine:latest RUN apk --no-cache add ca-certificates WORKDIR /root/ # Copy the pre-built binary file from the previous stage COPY --from=builder /app/btcpaychecker . # Command to run the executable CMD ["./btcpaychecker"]