FROM rockylinux:9 AS builder # Install build dependencies RUN dnf install -y git golang make gcc # Copy local source WORKDIR /build COPY . . # Build RUN go build -v -mod=vendor -o mattermost ./cmd/mattermost # Runtime image FROM rockylinux:9-minimal RUN microdnf install -y ca-certificates tzdata && microdnf clean all WORKDIR /mattermost COPY --from=builder /build/mattermost /mattermost/bin/mattermost COPY --from=builder /build/config /mattermost/config COPY --from=builder /build/i18n /mattermost/i18n COPY --from=builder /build/fonts /mattermost/fonts COPY --from=builder /build/templates /mattermost/templates COPY --from=builder /build/client /mattermost/client RUN mkdir -p /mattermost/data /mattermost/logs /mattermost/plugins /mattermost/client/plugins EXPOSE 8065 ENTRYPOINT ["/mattermost/bin/mattermost"]