Skip to content

Commit

Permalink
Include LICENSE files in image (#10)
Browse files Browse the repository at this point in the history
This commit alters the 'build' target
to find all of the LICENSE files in
the source code and include them in a
/licenses directory inside the container
image. Inclusion of the license files may
be a requirement for some to distribute
the cloud-discovery container image.
  • Loading branch information
jpadams authored and Liron Levin committed Mar 22, 2019
1 parent fa2681e commit 8d875eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/*
cert*
cert*
licenses
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app cmd/server/ma

FROM alpine:3.8
RUN apk --no-cache add ca-certificates nmap
WORKDIR /licenses
COPY /licenses/* ./
WORKDIR /root/
COPY --from=0 /go/src/github.com/twistlock/cloud-discovery/app .
CMD ["./app"]
CMD ["./app"]
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.PHONY: build

build:
docker build -t twistlock/cloud-discovery .
# Find all of the open source LICENSE files in the source code and include them in a /licenses directory inside the container image.
# Inclusion of the license files may be a requirement for some to distribute the cloud-discovery container image.
rm -rf licenses; mkdir -p licenses; find . | grep LICENSE | while IFS= read -r pathname; do filename=$$(echo $$pathname | tr "\.\/" "_" | sed "s/^__//"); cp $$pathname licenses/$$filename; done
docker build -t twistlock/cloud-discovery .

0 comments on commit 8d875eb

Please sign in to comment.