-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
418 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
FROM golang:1.22.5-alpine AS builder | ||
# Install required packages and set up workspace in a single layer | ||
RUN apk add --no-cache ca-certificates && update-ca-certificates | ||
# Install required system packages | ||
RUN apk update && \ | ||
apk upgrade && \ | ||
apk add --no-cache ca-certificates && \ | ||
update-ca-certificates | ||
|
||
WORKDIR /build | ||
|
||
# Copy all necessary files in a single layer | ||
COPY . . | ||
# Copy go mod and source files | ||
COPY go.mod go.sum ./ | ||
COPY *.go ./ | ||
|
||
# Download dependencies | ||
RUN go mod download | ||
|
||
# Build the application | ||
RUN go mod download && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o proxy-server ./cmd/main.go | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o proxy-server . | ||
|
||
# Final stage - minimal image | ||
# Final stage | ||
FROM scratch | ||
WORKDIR /app | ||
|
||
# Copy only the necessary files from builder | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=builder /build/proxy-server . | ||
COPY --from=builder /build/proxies.conf ./proxies.conf | ||
COPY --from=builder /build/users.conf ./users.conf | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
|
||
EXPOSE 1080 | ||
CMD ["./proxy-server"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.