sonatype-nexus-community / nancy

A tool to check for vulnerabilities in your Golang dependencies, powered by Sonatype OSS Index
Apache License 2.0
564 stars 74 forks source link

Building docker image locally #93

Closed AndreyMZ closed 3 years ago

AndreyMZ commented 4 years ago

Steps to reproduce

docker build -t nancy:latest .

Actual result

C:\nancy>docker build -t nancy:latest .
Sending build context to Docker daemon  19.07MB
Step 1/8 : FROM alpine:latest as builder
 ---> 11cd0b38bc3c
Step 2/8 : RUN apk update     && apk upgrade     && apk add --no-cache ca-certificates     && update-ca-certificates 2>/dev/null || true     && rm -rf /var/cache/apk/*
 ---> Using cache
 ---> 6b6b2114f9b6
Step 3/8 : COPY nancy /
COPY failed: stat /var/lib/docker/tmp/docker-builder436129135/nancy: no such file or directory

Expected result

No errors.

cc @bhamail / @DarthHater

DarthHater commented 4 years ago

This Dockerfile is meant to be used AFTER a build of nancy itself, hence the copy nancy /. We use the Dockerfile in goreleaser, and it runs after we've built the executables we need. It's not meant to be used locally, as we publish these images to Dockerhub. The reason we have a builder image is not to build Nancy, but to copy the ca-certs etc... into the scratch image for use. To this point, this is why there is no "build with Docker" instructions in our README.

DarthHater commented 4 years ago

Images available here, ps: https://hub.docker.com/r/sonatypecommunity/nancy

AndreyMZ commented 4 years ago

OK, then this issue is not a bug, but feature request:

  1. It would be great to have an ability to easily build Docker image locally. This is needed for testing the Docker image before commit and release. Maybe there should be a proper instruction how to build nancy before building Docker image. Just go build is not enough, because local environment may differ from the Docker one (e.g. Windows vs Linux).
  2. It would be also nice to have an ability to build the Docker image locally without installing go locally.