fix: update Docker Hub login step to be optional and clean up registry login process
Some checks failed
Build And Publish Production Image / Build And Publish Production Image (push) Failing after 1m28s
Some checks failed
Build And Publish Production Image / Build And Publish Production Image (push) Failing after 1m28s
This commit is contained in:
@@ -22,16 +22,13 @@ jobs:
|
||||
- name: Verify Docker CLI
|
||||
run: docker version
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
- name: Log in to Docker Hub (optional)
|
||||
if: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}
|
||||
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login docker.io -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Build all-in-one image
|
||||
run: docker build -t condado-newsletter:latest -f Dockerfile.allinone .
|
||||
|
||||
- name: log the docker registry login credentials (for debugging)
|
||||
run: |
|
||||
echo "$REGISTRY_PASSWORD" | base64
|
||||
|
||||
- name: Log in to Gitea container registry
|
||||
run: |
|
||||
if [ -z "$REGISTRY_USERNAME" ]; then
|
||||
@@ -44,14 +41,15 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$REGISTRY_PASSWORD" | docker login ${REGISTRY} -u "$REGISTRY_USERNAME" --password-stdin
|
||||
echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY" -u "$REGISTRY_USERNAME" --password-stdin
|
||||
|
||||
- name: Tag registry images
|
||||
run: |
|
||||
docker tag condado-newsletter:latest ${REGISTRY}/${IMAGE_NAME}:latest
|
||||
docker tag condado-newsletter:latest ${REGISTRY}/${IMAGE_NAME}:${{ github.sha }}
|
||||
|
||||
- name: Push registry images
|
||||
run: |
|
||||
docker push ${REGISTRY}/${IMAGE_NAME}:latest
|
||||
docker push ${REGISTRY}/${IMAGE_NAME}:${{ github.sha }}
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
tags: ://gitea.lab:80{{ gitea.repository }}:latest
|
||||
|
||||
Reference in New Issue
Block a user