forked from ekristen/aws-nuke
-
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
3 changed files
with
73 additions
and
406 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,29 +1,24 @@ | ||
FROM golang:1.21-alpine as builder | ||
|
||
RUN apk add --no-cache git make curl openssl | ||
|
||
# Configure Go | ||
ENV GOPATH=/go PATH=/go/bin:$PATH CGO_ENABLED=0 GO111MODULE=on | ||
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin | ||
|
||
WORKDIR /src | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN set -x \ | ||
&& make build \ | ||
&& cp /src/dist/aws-nuke /usr/local/bin/ | ||
|
||
FROM alpine:latest | ||
# syntax=docker/dockerfile:1.10-labs | ||
FROM alpine:3.20.3 as base | ||
RUN apk add --no-cache ca-certificates | ||
RUN adduser -D aws-nuke | ||
|
||
COPY --from=builder /usr/local/bin/* /usr/local/bin/ | ||
FROM ghcr.io/acorn-io/images-mirror/golang:1.21 AS build | ||
COPY / /src | ||
WORKDIR /src | ||
ENV CGO_ENABLED=0 | ||
RUN \ | ||
--mount=type=cache,target=/go/pkg \ | ||
--mount=type=cache,target=/root/.cache/go-build \ | ||
go build -ldflags '-s -w -extldflags="-static"' -o bin/aws-nuke main.go | ||
|
||
RUN adduser -D aws-nuke | ||
FROM base AS goreleaser | ||
ENTRYPOINT ["/usr/local/bin/aws-nuke"] | ||
COPY aws-nuke /usr/local/bin/aws-nuke | ||
USER aws-nuke | ||
|
||
FROM base | ||
ENTRYPOINT ["/usr/local/bin/aws-nuke"] | ||
COPY --from=build --chmod=755 /src/bin/aws-nuke /usr/local/bin/aws-nuke | ||
RUN chmod +x /usr/local/bin/aws-nuke | ||
USER aws-nuke |
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
Oops, something went wrong.