Created
March 26, 2024 22:22
-
-
Save nenodias/cc701e6dfb91b9318b97ca7396fd3eda to your computer and use it in GitHub Desktop.
Revisions
-
nenodias created this gist
Mar 26, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ FROM debian:12-slim as builder RUN apt update && apt install -y --no-install-recommends \ ca-certificates \ git \ wget \ tar \ gcc \ g++ \ make \ build-essential \ && rm -rf /var/lib/apt/lists/* RUN wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz && rm go1.22.1.linux-amd64.tar.gz ENV PATH=$PATH:/usr/local/go/bin WORKDIR /app RUN addgroup app RUN useradd -ms /bin/bash app -g app -d /app COPY ./src/ . RUN go mod tidy RUN go test ./... RUN go vet ./... RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o main . RUN chmod +x main FROM cgr.dev/chainguard/glibc-dynamic ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 USER nonroot COPY --from=builder --chown=nonroot:nonroot /app/main /main CMD ["./main" ]