18 lines
617 B
Docker
18 lines
617 B
Docker
ARG BASE_REGISTRY=docker.io/library
|
|
FROM ${BASE_REGISTRY}/golang:1.25-alpine AS build
|
|
ARG GOPROXY=https://goproxy.cn|https://goproxy.io|https://proxy.golang.org|direct
|
|
ENV GOPROXY=${GOPROXY}
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN apk add --no-cache ca-certificates
|
|
RUN go mod download
|
|
COPY . ./
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags='-s -w' -o /out/iotlcm-bot ./cmd/iotlcm-bot
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
COPY --from=build /out/iotlcm-bot /usr/local/bin/iotlcm-bot
|
|
USER 65532:65532
|
|
ENTRYPOINT ["/usr/local/bin/iotlcm-bot"]
|