-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (43 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
57 lines (43 loc) · 1.11 KB
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
49
50
51
52
53
54
55
56
57
# Multi-stage build for F.I.R.E.
FROM golang:1.23-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git make
# Set working directory
WORKDIR /build
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the application
ARG VERSION=dev
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags "-s -w -X github.com/mscrnt/project_fire/internal/version.Version=${VERSION}" \
-o bench ./cmd/fire
# Final stage
FROM alpine:latest
# Install runtime dependencies
RUN apk add --no-cache \
ca-certificates \
stress-ng \
fio \
bash \
&& rm -rf /var/cache/apk/*
# Create non-root user
RUN addgroup -g 1000 fire && \
adduser -D -u 1000 -G fire fire
# Copy binary from builder
COPY --from=builder /build/bench /usr/local/bin/bench
# Create working directory
WORKDIR /home/fire
RUN chown -R fire:fire /home/fire
# Switch to non-root user
USER fire
# Set environment
ENV HOME=/home/fire
ENV FIRE_DATA_DIR=/home/fire/data
# Expose agent port (if running in agent mode)
EXPOSE 2223
# Default command
ENTRYPOINT ["bench"]
CMD ["--help"]