File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1+ # Stage 1: Build the Go application
12FROM golang:1.22.5-alpine AS builder
23# Install required system packages
34RUN apk update && \
@@ -17,16 +18,20 @@ RUN go mod download
1718# Build the application
1819RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o proxy-server .
1920
20- # Intermediate stage to include nc
21+ # Stage 2: Build the nc binary
2122FROM alpine:latest AS nc-builder
2223RUN apk add --no-cache netcat-openbsd
2324
24- # Final stage
25+ # Stage 3: Final scratch image
2526FROM scratch
2627WORKDIR /app
28+
29+ # Copy the Go binary and CA certificates
2730COPY --from=builder /build/proxy-server .
2831COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
29- COPY --from=nc-builder /bin/nc /bin/nc
32+
33+ # Copy the nc binary from the nc-builder stage
34+ COPY --from=nc-builder /usr/bin/nc /bin/nc
3035
3136EXPOSE 1080
32- CMD ["./proxy-server" ]
37+ CMD ["./proxy-server" ]
You can’t perform that action at this time.
0 commit comments