Skip to content

Commit

Permalink
adds docker file #14
Browse files Browse the repository at this point in the history
  • Loading branch information
benammann committed May 20, 2022
1 parent dc86042 commit d23a37a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Build the manager binary
FROM golang:1.17 as builder

WORKDIR /git-secrets
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY . .

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o git-secrets main.go

FROM bash
WORKDIR /git-secrets

RUN apk add --no-cache bash
RUN apk add curl
RUN apk add git

RUN mkdir -p bin

COPY --from=builder /git-secrets/git-secrets bin/git-secrets

RUN adduser -D gitsecrets
RUN chown -R 1000:1000 .
USER gitsecrets

ENV PATH="/git-secrets/bin:${PATH}"

ENTRYPOINT ["git-secrets"]

0 comments on commit d23a37a

Please sign in to comment.