I want to run my workflow in a container from private Docker registry:
jobs:
build:
runs-on: ubuntu-latest
container:
image: my-registry.net/my-image:latest
steps:
- ...
Now my docker registry is internal and can be accessed via vpn. So I thought I'd have a workaround by running another job that pulls the image:
jobs:
tailscale:
runs-on: ubuntu-latest
steps:
- name: Connect to Tailscale
uses: tailscale/github-action@v1
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
version: 1.18.2
- name: Login to Private Container Registry
uses: docker/login-action@v1
with:
registry: my-registry.net
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Pull Image
run: docker pull my-registry.net/my-image:latest
build:
needs: tailscale
runs-on: ubuntu-latest
container:
image: my-registry.net/my-image:latest
steps:
- ...
However, this solution doesn't work because GitHub doesn't use the same runner for different jobs, as discussed here. How do I go about this without using my own runners?
Create an action with your "connecting" code and reuses it because without using your own runner, you need to connect every time in your VPN to get access to your registry.