Gal Podlipnik 51428eb2f5
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m10s
fix mby v6
2025-06-09 02:49:10 +02:00

62 lines
2.2 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches: [master]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Docker CLI
run: |
apt-get update
apt-get install -y ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
bullseye stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin
# Add step to configure Docker for possible insecure registry
- name: Configure Docker for Harbor
run: |
mkdir -p /etc/docker
echo '{"insecure-registries": ["harbor.galpodlipnik.com"]}' > /etc/docker/daemon.json
# Restart Docker to apply changes
service docker restart || true
# Add some diagnostic info
echo "Testing connectivity to Harbor..."
curl -v --connect-timeout 10 https://harbor.galpodlipnik.com || echo "Connection failed but continuing"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Login to Harbor with retries
uses: docker/login-action@v3
with:
registry: harbor.galpodlipnik.com
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
# Add a longer timeout for login attempts
timeout: 180
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: harbor.galpodlipnik.com/project/docker-inspector:latest
cache-from: type=registry,ref=harbor.galpodlipnik.com/project/docker-inspector:buildcache
cache-to: type=registry,ref=harbor.galpodlipnik.com/project/docker-inspector:buildcache,mode=max