Commit 6f6c329
authored
fix: add Docker Hub login before building image (#29)
# Motivation
The Docker image build is failing with authentication error:
```
401 Unauthorized
{"details":"access token has insufficient scopes"}
```
This prevents the Docker image from being published to Docker Hub.
# Description
## Root Cause
The Jib Maven plugin needs Docker Hub credentials to push images. It was
trying to use credentials from the Docker config file
(`~/.docker/config.json`), but this file didn't exist or didn't have
valid credentials.
The error message indicates that Jib couldn't authenticate:
```
Build image failed, perhaps you should make sure your credentials for
'registry-1.docker.io/dockerhubaneo/armonik-dynamic-java-worker' are set up correctly
```
## Solution
Add an explicit Docker login step before building the image:
```yaml
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_LOGIN }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
```
This creates credentials in `~/.docker/config.json` that Jib
automatically reads when pushing images.1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
136 | 142 | | |
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
142 | 148 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| |||
0 commit comments