I need to add a repository using zypper that requires authentication from a Dockerfile. I'm able to add it, but of course, when I try to run
zypper -n refresh
It fails because the authentication failed.
What is the normal approach to automate the authentication process? Didn't find a good answer while "googling".
Solved it like this:
Dockerfile
ARG MY_REPO_USERNAME
ARG MY_REPO_PASSWORD
RUN zypper -n addrepo https://$MY_REPO_USERNAME:$MY_REPO_PASSWORD@repo.domain/foo/bar repo-domain-alias
When building the image:
docker build --build-arg MY_REPO_USERNAME=my_username --build-arg MY_REPO_PASSWORD=my_password -tag my-image-name .