FROM golang:1.26-alpine AS builder
WORKDIR /app
RUN apk add --no-cache git
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o intent-wechat ./cmd/wechat

FROM alpine:latest
ARG RELEASE=local
ENV RELEASE=${RELEASE}
WORKDIR /app
RUN apk --no-cache add ca-certificates tzdata
COPY --from=builder /app/intent-wechat .
ENV WX_NEW_CHANNEL_POLL_INTERVAL=10
CMD ["./intent-wechat"]
