37 lines
721 B
Docker
37 lines
721 B
Docker
FROM golang:1.21-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache git gcc musl-dev
|
|
|
|
# Copy and download dependencies
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /go/bin/fuckhttp3 .
|
|
|
|
# Create a minimal runtime image
|
|
FROM alpine:latest
|
|
|
|
WORKDIR /app
|
|
|
|
# Install runtime dependencies
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
# Copy the binary from the builder stage
|
|
COPY --from=builder /go/bin/fuckhttp3 .
|
|
|
|
# Copy certificates
|
|
COPY cert.pem key.pem ./
|
|
|
|
# Expose the HTTP/3 port (UDP for QUIC)
|
|
EXPOSE 8443/udp
|
|
EXPOSE 8443/tcp
|
|
|
|
# Run the application
|
|
ENTRYPOINT ["./fuckhttp3"] |