diff --git a/benchmark-proxy/Dockerfile b/benchmark-proxy/Dockerfile index 399bd3f0..28ea9b2e 100644 --- a/benchmark-proxy/Dockerfile +++ b/benchmark-proxy/Dockerfile @@ -1,16 +1,27 @@ -FROM golang:1.21-alpine as builder +# Build stage +FROM golang:1.21-alpine AS builder WORKDIR /app + +# Initialize Go modules if not already done +RUN go mod init benchmark-proxy + +# Add the dependency before building +RUN go get github.com/gorilla/websocket + +# Copy source code COPY . . -# Build with optimization flags +# Build the application with CGO disabled for a static binary RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o benchmark-proxy main.go -FROM alpine:3.18 +# Runtime stage (if you're using a multi-stage build) +FROM alpine:latest -RUN apk --no-cache add ca-certificates tzdata WORKDIR /app + +# Copy the binary from the build stage COPY --from=builder /app/benchmark-proxy . -EXPOSE 8080 -CMD ["./benchmark-proxy"] \ No newline at end of file +# Run the application +ENTRYPOINT ["./benchmark-proxy"] \ No newline at end of file