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
|
- name: Verify Docker CLI
|
||||||
run: docker version
|
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
|
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login docker.io -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
|
||||||
|
|
||||||
- name: Build all-in-one image
|
- name: Build all-in-one image
|
||||||
run: docker build -t condado-newsletter:latest -f Dockerfile.allinone .
|
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
|
- name: Log in to Gitea container registry
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$REGISTRY_USERNAME" ]; then
|
if [ -z "$REGISTRY_USERNAME" ]; then
|
||||||
@@ -44,14 +41,15 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
- name: Tag registry images
|
||||||
run: |
|
run: |
|
||||||
docker tag condado-newsletter:latest ${REGISTRY}/${IMAGE_NAME}:latest
|
docker tag condado-newsletter:latest ${REGISTRY}/${IMAGE_NAME}:latest
|
||||||
docker tag condado-newsletter:latest ${REGISTRY}/${IMAGE_NAME}:${{ github.sha }}
|
docker tag condado-newsletter:latest ${REGISTRY}/${IMAGE_NAME}:${{ github.sha }}
|
||||||
|
|
||||||
- name: Push registry images
|
- name: Build and Push
|
||||||
run: |
|
uses: docker/build-push-action@v5
|
||||||
docker push ${REGISTRY}/${IMAGE_NAME}:latest
|
with:
|
||||||
docker push ${REGISTRY}/${IMAGE_NAME}:${{ github.sha }}
|
push: true
|
||||||
|
tags: ://gitea.lab:80{{ gitea.repository }}:latest
|
||||||
|
|||||||
Reference in New Issue
Block a user