Fix workflow: use DinD instead of docker:latest

This commit is contained in:
masoud
2025-12-06 14:03:36 +00:00
parent d606615206
commit be8d8c26fa

View File

@@ -5,44 +5,52 @@ on:
branches: branches:
- kub-stage - kub-stage
env:
REGISTRY: 194.5.195.53:30080
IMAGE_NAME: admin/backoffice-bff
jobs: jobs:
build-and-deploy: build-and-push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: docker:latest image: catthehacker/ubuntu:act-latest
options: --privileged options: --privileged
env:
HTTP_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128 services:
HTTPS_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128 dind:
NO_PROXY: localhost,127.0.0.1,gitea-svc,194.5.195.53,10.0.0.0/8 image: docker:27-dind
options: --privileged
env:
DOCKER_TLS_CERTDIR: ""
HTTP_PROXY: "http://proxyuser:87zH26nbqT2@46.249.98.211:3128"
HTTPS_PROXY: "http://proxyuser:87zH26nbqT2@46.249.98.211:3128"
NO_PROXY: "localhost,127.0.0.1,gitea-svc,194.5.195.53"
env:
DOCKER_HOST: tcp://dind:2375
HTTP_PROXY: "http://proxyuser:87zH26nbqT2@46.249.98.211:3128"
HTTPS_PROXY: "http://proxyuser:87zH26nbqT2@46.249.98.211:3128"
NO_PROXY: "localhost,127.0.0.1,dind,gitea-svc,194.5.195.53"
steps: steps:
- name: Install git - uses: actions/checkout@v4
run: apk add --no-cache git
- name: Clone repository - name: Wait for Docker
run: git clone --depth 1 --branch kub-stage http://gitea-svc:3000/admin/BackOffice.BFF.git .
- name: Start Docker daemon
run: | run: |
mkdir -p /etc/docker for i in {1..30}; do
echo '{"insecure-registries": ["194.5.195.53:30080"]}' > /etc/docker/daemon.json if docker info >/dev/null 2>&1; then
dockerd & echo "Docker is ready"
for i in $(seq 1 30); do docker info >/dev/null 2>&1 && break || sleep 2; done exit 0
fi
echo "Waiting for Docker... ($i/30)"
sleep 2
done
exit 1
- name: Build Docker Image - name: Build image
run: | run: |
docker build -t $REGISTRY/$IMAGE_NAME:${{ github.sha }} \ docker build -t 194.5.195.53:30080/admin/backoffice-bff:latest .
-t $REGISTRY/$IMAGE_NAME:latest \
--build-arg HTTP_PROXY=$HTTP_PROXY \
--build-arg HTTPS_PROXY=$HTTPS_PROXY .
- name: Push to Registry - name: Login to registry
run: | run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login $REGISTRY -u admin --password-stdin echo "${{ secrets.REGISTRY_PASSWORD }}" | \
docker push $REGISTRY/$IMAGE_NAME:${{ github.sha }} docker login 194.5.195.53:30080 -u admin --password-stdin
docker push $REGISTRY/$IMAGE_NAME:latest
- name: Push image
run: docker push 194.5.195.53:30080/admin/backoffice-bff:latest