Update .gitea/workflows/build-and-push.yaml
Some checks failed
Build and Push Container Image / build-and-push (push) Failing after 4s
Some checks failed
Build and Push Container Image / build-and-push (push) Failing after 4s
This commit is contained in:
@@ -14,8 +14,11 @@ jobs:
|
|||||||
image: docker:latest
|
image: docker:latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install git
|
- name: Install tools
|
||||||
run: apk add --no-cache git
|
run: |
|
||||||
|
apk add --no-cache git curl
|
||||||
|
# Install crane for pushing to insecure registries
|
||||||
|
curl -sL https://github.com/google/go-containerregistry/releases/latest/download/go-containerregistry_Linux_x86_64.tar.gz | tar -xz -C /usr/local/bin crane
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
run: |
|
run: |
|
||||||
@@ -31,24 +34,16 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Setup registry auth
|
- name: Build image
|
||||||
run: |
|
|
||||||
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
|
||||||
AUTH=$(echo -n "${{ gitea.actor }}:${{ secrets.REGISTRY_TOKEN }}" | base64)
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
cat > ~/.docker/config.json <<EOF
|
|
||||||
{
|
|
||||||
"auths": {
|
|
||||||
"${REGISTRY_HOST}": {
|
|
||||||
"auth": "${AUTH}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Build and push image
|
|
||||||
run: |
|
run: |
|
||||||
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
||||||
IMAGE="${REGISTRY_HOST}/${{ gitea.repository }}:${{ steps.meta.outputs.tag }}"
|
IMAGE="${REGISTRY_HOST}/${{ gitea.repository }}:${{ steps.meta.outputs.tag }}"
|
||||||
docker build -t "${IMAGE}" .
|
docker build -t "${IMAGE}" .
|
||||||
docker push "${IMAGE}"
|
docker save "${IMAGE}" -o image.tar
|
||||||
|
|
||||||
|
- name: Push image
|
||||||
|
run: |
|
||||||
|
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
||||||
|
IMAGE="${REGISTRY_HOST}/${{ gitea.repository }}:${{ steps.meta.outputs.tag }}"
|
||||||
|
crane auth login "${REGISTRY_HOST}" -u "${{ gitea.actor }}" -p "${{ secrets.REGISTRY_TOKEN }}" --insecure
|
||||||
|
crane push image.tar "${IMAGE}" --insecure
|
||||||
Reference in New Issue
Block a user