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 # Create templates directory RUN mkdir -p templates # Copy templates first COPY templates/ templates/ # 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 ./ # Create templates directory and copy templates RUN mkdir -p templates COPY templates/ templates/ # Expose the HTTP/3 port (UDP for QUIC) EXPOSE 8443/udp EXPOSE 8443/tcp # Run the application ENTRYPOINT ["./fuckhttp3"]