Fix - docker builds for scorecard cron

Fixed the docker build for scorecard cron and as well as updated the
integration to test for the docker builds.
This commit is contained in:
naveen 2021-03-05 16:45:34 +00:00 committed by Naveen
parent cef322b809
commit 248fda288e
3 changed files with 18 additions and 8 deletions

View File

@ -84,7 +84,7 @@ jobs:
ginkgo --focus="E2E TEST:executable|E2E TEST:blob" ./e2e/...
- name: Build docker image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
run: make dockerbuild
- name: Test docker image
env:

View File

@ -11,12 +11,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM golang:1.16 as app
COPY . /go/src/github.com/ossf/scorecard
WORKDIR /go/src/github.com/ossf/scorecard
RUN [ "go", "build", "."]
# syntax = docker/dockerfile:1-experimental
FROM golang:1.16 as base
WORKDIR /src
ENV CGO_ENABLED=0
COPY go.* ./
RUN go mod download
COPY . ./
FROM base AS build
ARG TARGETOS
ARG TARGETARCH
RUN CGO_ENABLED=0 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o /out/scorecard .
FROM gcr.io/cloud-builders/gsutil
WORKDIR /go/src/github.com/ossf/scorecard
COPY --from=app /go/src/github.com/ossf/scorecard /go/src/github.com/ossf/scorecard
ENTRYPOINT [ "./scorecard" ]
COPY --from=build /out/scorecard /
ENTRYPOINT [ "/scorecard" ]

View File

@ -105,4 +105,5 @@ verify-go-mod: ## Verify the go modules
dockerbuild: ## Runs docker build
$(call ndef, GITHUB_AUTH_TOKEN)
docker build . --file Dockerfile --tag $(IMAGE_NAME)
docker build . --file Dockerfile.gsutil --tag $(IMAGE_NAME)-gsutil