We have specific issue. Because of legacy things we have decided to run all build tasks inside container build with ECR plugin. The problem we have is that we don’t know how to grant access to our private repositories on build. We know that we can do the same thing with just moving building parts into steps, but It would require changing not only code, but also developers local workflow which we would like to avoid for now.
We know that Drone is using .netrc file to authenticate to repositories, but this obviously doesn’t work by default with Dockerfiles. Our goal is to not store git credentials inside docker container, so adding command like COPY .netrc inside Dockerfile is not an option.
Does anybody have problem like this? Maybe somebody have any suggestion to this issue?
If possible could you please share your drone yaml file for our review, as I am not clear with use case here so after looking into yaml we can suggest acordingly.
As I can think of one way is to pass below as env variable:
If that is the case you could use build_args as mentioned here Docker | Drone to pass through information to the docker plugin, then into your dockerfile
@TP_Honey I was able to pass credentials with build_args. The problem I can see with that aproach is that It needs to persist somewhere in the container. Honestly I don’t believe that all teams will remember to remove credentials file from created image. I need solution like the one described in this PR: Add build secret flag by nashiox · Pull Request #264 · drone-plugins/drone-docker · GitHub
This will solve my issue, because I will be able to pass .netrc file as a secret in Docker build and it will not persist on container image.
Can you look again at provided PR or just think about your implementation of this feature. I think that there will be a lot of people which will like to use it in their pipelines.