File tree Expand file tree Collapse file tree 7 files changed +418
-541
lines changed Expand file tree Collapse file tree 7 files changed +418
-541
lines changed Original file line number Diff line number Diff line change 1
1
FROM golang:1.22.5-alpine AS builder
2
- # Install required packages and set up workspace in a single layer
3
- RUN apk add --no-cache ca-certificates && update-ca-certificates
2
+ # Install required system packages
3
+ RUN apk update && \
4
+ apk upgrade && \
5
+ apk add --no-cache ca-certificates && \
6
+ update-ca-certificates
4
7
5
8
WORKDIR /build
6
9
7
- # Copy all necessary files in a single layer
8
- COPY . .
10
+ # Copy go mod and source files
11
+ COPY go.mod go.sum ./
12
+ COPY *.go ./
13
+
14
+ # Download dependencies
15
+ RUN go mod download
9
16
10
17
# Build the application
11
- RUN go mod download && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o proxy-server ./cmd/main.go
18
+ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o proxy-server .
12
19
13
- # Final stage - minimal image
20
+ # Final stage
14
21
FROM scratch
15
22
WORKDIR /app
16
-
17
- # Copy only the necessary files from builder
18
- COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
19
23
COPY --from=builder /build/proxy-server .
20
- COPY --from=builder /build/proxies.conf ./proxies.conf
21
- COPY --from=builder /build/users.conf ./users.conf
24
+ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
22
25
23
26
EXPOSE 1080
24
27
CMD ["./proxy-server" ]
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments