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
1
2
FROM golang:1.22.5-alpine AS builder
2
3
# Install required system packages
3
4
RUN apk update && \
@@ -17,16 +18,20 @@ RUN go mod download
17
18
# Build the application
18
19
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o proxy-server .
19
20
20
- # Intermediate stage to include nc
21
+ # Stage 2: Build the nc binary
21
22
FROM alpine:latest AS nc-builder
22
23
RUN apk add --no-cache netcat-openbsd
23
24
24
- # Final stage
25
+ # Stage 3: Final scratch image
25
26
FROM scratch
26
27
WORKDIR /app
28
+
29
+ # Copy the Go binary and CA certificates
27
30
COPY --from=builder /build/proxy-server .
28
31
COPY --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
30
35
31
36
EXPOSE 1080
32
- CMD ["./proxy-server" ]
37
+ CMD ["./proxy-server" ]
You can’t perform that action at this time.
0 commit comments