cmd/shfmt/Dockerfile
raw| 1 | FROM golang:1.27.0-alpine AS build |
| 2 | |
| 3 | WORKDIR /src |
| 4 | RUN apk add --no-cache git |
| 5 | COPY . . |
| 6 | RUN CGO_ENABLED=0 go build -ldflags "-w -s -extldflags '-static'" ./cmd/shfmt |
| 7 | |
| 8 | FROM alpine:3.24.1 AS alpine |
| 9 | COPY --from=build /src/shfmt /bin/shfmt |
| 10 | COPY "./cmd/shfmt/docker-entrypoint.sh" "/init" |
| 11 | ENTRYPOINT ["/init"] |
| 12 | |
| 13 | FROM scratch |
| 14 | COPY --from=build /src/shfmt /bin/shfmt |
| 15 | ENTRYPOINT ["/bin/shfmt"] |
| 16 | CMD ["-h"] |