Skip to content

Commit

Permalink
Merge pull request #82 from willnorris/docker
Browse files Browse the repository at this point in the history
fix building docker image
  • Loading branch information
mco-gh authored Jul 29, 2021
2 parents 0f8d403 + e596161 commit ef04bb3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 17 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
FROM golang:1-alpine AS build-env
FROM golang:1.16 AS build

RUN apk add --no-cache --upgrade git openssh-client ca-certificates
RUN go get -u github.com/golang/dep/cmd/dep
WORKDIR /go/src/app
WORKDIR /app

# Install
RUN go get -u github.com/google/addlicense
COPY go.mod go.sum ./
RUN go mod download

ENTRYPOINT ["addlicense"]
# copy source and build
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build .


# make a bare minimal image
FROM scratch

# source to be scanned should be mounted to /src
WORKDIR /src
COPY --from=build /app/addlicense /app/addlicense

ENTRYPOINT ["/app/addlicense"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ docker run -it google/addlicense -h

- Usage example
```bash
docker run -v ${PWD}:/go/src/app/ -it google/addlicense -c "Google LLC" *.go
docker run -v ${PWD}:/src -it google/addlicense -c "Google LLC" *.go
```

## license
Expand Down

0 comments on commit ef04bb3

Please sign in to comment.