doc: update docker file to incldue multi-stage build from source with enterprise bypass

This commit is contained in:
Leon Xu
2026-08-06 20:05:30 -07:00
parent 59407ed1e2
commit 29e8f2bdb7
+24 -1
View File
@@ -1,3 +1,23 @@
# Build stage — compiles Fleet from source
FROM golang:1.26.5-alpine AS builder
ARG FLEET_VERSION=unknown
WORKDIR /build
RUN apk add --no-cache git ca-certificates gcc musl-dev make
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=1 GOOS=linux go build -o fleet \
-tags=full,fts5,netgo \
-trimpath \
-ldflags="-s -w -extldflags '-static'" \
./cmd/fleet
# Runtime stage
FROM alpine:3.23.4@sha256:5b10f432ef3da1b8d4c7eb6c487f2f5a8f096bc91145e68878dd4a5019afde11
ARG FLEET_VERSION=unknown
LABEL maintainer="Fleet Developers"
@@ -15,8 +35,11 @@ RUN apk --no-cache upgrade openssl libcrypto3 libssl3
# Create fleet group and user
RUN addgroup -S fleet && adduser -S fleet -G fleet
# Create installers directory
RUN mkdir -p /opt/fleet/installers && chown -R fleet:fleet /opt/fleet
USER fleet
COPY fleet /usr/bin/
COPY --from=builder /build/fleet /usr/bin/fleet
CMD ["fleet", "serve"]