dockergitlab-cigitlab-ci-runner

Access directory of hostmachine during docker build - Gitlab Runner


I am currently working on the CICD pipeline for our web project. It is a C# blazor web application.

Since we are using our own Nuget packages, I need to install/add our local certificate authority during the build stage. Otherwise, the Nuget packages cannot be retrieved. Currently, the certificate is part of the project. However, I would prefer to store this certificate in a directory on the host machine and access it during the pipeline. (If you have other recommendations, I'd be happy to take them too.) This way, each of our projects can access it.

I start the Gitlab runner as a Docker container with the following volume: -v /usr/local/share/ca-certificates:/usr/local/share/ca-certificates Logically, the corresponding CA certificates are located under /usr/local/share/ca-certificates on the host machine.

In the runner config, I have specified the volume accordingly in the [runners.docker] section: volumes = [..., "/usr/local/share/ca-certificates:/usr/local/share/ca-certificates"]

Finally, I added the volume to the Dockerfile accordingly: VOLUME /usr/local/share/ca-certificates:/usr/local/share/ca-certificates

However, the subsequent update-ca-certificates command does not find any files.

Is this the correct procedure? In my understanding, the structure would be as shown in this diagram: system diagram I would be very grateful for any help!

Best regards Lukas


Solution

  • As proposed by @Hans Kilian, I made my custom images with the ca-certificates already installed and use them for the build processes.

    That works like a charm. Thanks!