forked from praetorian-inc/brutus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (35 loc) · 1022 Bytes
/
Copy pathDockerfile
File metadata and controls
48 lines (35 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Build stage
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache git ca-certificates
# Copy go mod files first for caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build arguments for version info
ARG VERSION=dev
ARG BUILD_TIME
ARG COMMIT_SHA
# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath \
-ldflags="-s -w \
-X main.Version=${VERSION} \
-X main.BuildTime=${BUILD_TIME} \
-X main.CommitSHA=${COMMIT_SHA}" \
-o brutus ./cmd/brutus
# Final stage
FROM alpine:3.19
# Install runtime dependencies
RUN apk add --no-cache ca-certificates tzdata
# Create non-root user
RUN adduser -D -g '' brutus
USER brutus
WORKDIR /home/brutus
# Copy binary from builder
COPY --from=builder /app/brutus /usr/local/bin/brutus
# Copy wordlists (optional - embedded in binary, but useful for customization)
COPY --from=builder /app/pkg/brutus/wordlists /home/brutus/wordlists
ENTRYPOINT ["brutus"]
CMD ["--help"]