open-im-server/Dockerfile
Jason Wang 714645edde fix(docker): pin base image versions for reproducible builds
- golang:alpine → golang:1.25-alpine (align with go.mod's go 1.25.0)
- alpine:latest → alpine:3.23 (pin runtime base image)

Floating tags make builds non-reproducible and can drift from the
Go version declared in go.mod. Pinning both stages keeps builds
deterministic and reduces supply-chain risk.
2026-08-24 11:07:21 +08:00

25 lines
622 B
Docker

FROM golang:1.25-alpine AS builder
ARG RELEASE=false
ARG COMPRESS=false
WORKDIR /openim-server
RUN apk add --no-cache upx
RUN go install github.com/magefile/mage@latest
COPY . .
RUN go mod download
RUN RELEASE=${RELEASE} COMPRESS=${COMPRESS} mage build
RUN mage -compile ./mage -ldflags "-s -w"
FROM alpine:3.23
WORKDIR /openim-server
COPY --from=builder /openim-server/_output ./_output
COPY --from=builder /openim-server/config ./config
COPY --from=builder /openim-server/start-config.yml ./start-config.yml
COPY --from=builder /openim-server/mage ./mage
ENTRYPOINT ["sh", "-c", "./mage start && sleep infinity"]