-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add multi-stage build support
Signed-off-by: Federico Simoncelli <[email protected]>
- Loading branch information
Showing
5 changed files
with
40 additions
and
4 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,4 +1,3 @@ | ||
.git | ||
image-inspector | ||
README.md | ||
*.a |
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,9 +1,9 @@ | ||
FROM centos:7 | ||
MAINTAINER Federico Simoncelli <[email protected]> | ||
|
||
RUN yum update -y && \ | ||
yum install -y golang openscap-scanner git && \ | ||
yum clean all | ||
RUN yum update -y --setopt=tsflags=nodocs && \ | ||
yum install -y --setopt=tsflags=nodocs golang openscap-scanner git && \ | ||
rm -rf /var/cache/yum | ||
|
||
COPY . /go/src/github.com/openshift/image-inspector | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM golang:1.7 | ||
MAINTAINER Federico Simoncelli <[email protected]> | ||
|
||
COPY . /go/src/github.com/openshift/image-inspector | ||
|
||
RUN GOBIN=/usr/bin \ | ||
CGO_ENABLED=0 \ | ||
go install -a -installsuffix cgo /go/src/github.com/openshift/image-inspector/cmd/image-inspector.go |
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
IMAGENAME=${IMAGENAME:-docker.io/openshift/image-inspector} | ||
EXTRACTNAME=${EXTRACTNAME:-image-inspector-extract} | ||
BINNAME=image-inspector | ||
|
||
rm -f ${BINNAME} | ||
|
||
echo Building ${IMAGENAME}:build | ||
|
||
docker build --no-cache --pull -t ${IMAGENAME}:build . -f Dockerfile.build | ||
|
||
docker create --name ${EXTRACTNAME} ${IMAGENAME}:build | ||
docker cp ${EXTRACTNAME}:/usr/bin/${BINNAME} ${BINNAME} | ||
docker rm -f ${EXTRACTNAME} | ||
|
||
echo Building ${IMAGENAME}:latest | ||
|
||
docker build --no-cache --pull -t ${IMAGENAME}:latest . |