-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (32 loc) · 1.06 KB
/
Dockerfile
File metadata and controls
46 lines (32 loc) · 1.06 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
# Build stage
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Install git for version information
RUN apk add --no-cache git
# Copy go mod files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the applications
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-X main.version=$(git describe --tags --always --dirty) -s -w" -o httprunner ./cmd/httprunner
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-X main.version=$(git describe --tags --always --dirty) -s -w" -o harparser ./cmd/harparser
# Final stage
FROM alpine:latest
# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates
WORKDIR /httprunner/
# Copy the binary from builder stage
COPY --from=builder /app/httprunner .
COPY --from=builder /app/harparser .
# Make it executable
RUN chmod +x ./httprunner
RUN chmod +x ./harparser
# Create a directory for HTTP request files
RUN mkdir -p /requests
RUN mkdir -p /reports
# Set the binary as the entrypoint
ENTRYPOINT []
# Default command shows help
CMD ["./httprunner", "--help"]