From 3cb0213ee041cdcda256704b10da48186869aba0 Mon Sep 17 00:00:00 2001 From: dcorral Date: Thu, 6 Nov 2025 21:05:07 +0100 Subject: [PATCH] add docker network --- .gitea/workflows/build-and-push.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/build-and-push.yml b/.gitea/workflows/build-and-push.yml index af7fe0f..9781497 100644 --- a/.gitea/workflows/build-and-push.yml +++ b/.gitea/workflows/build-and-push.yml @@ -18,8 +18,9 @@ jobs: - name: Run SSH server run: | + docker network create test-net || true docker rm -f ssh-server-test || true - docker run -d --name ssh-server-test -p 2223:22 -e COMMAND="/bin/sh" ssh-server-test + docker run -d --network test-net --name ssh-server-test -e COMMAND="/bin/sh" ssh-server-test sleep 2 if ! docker ps | grep -q ssh-server-test; then echo "Container failed to start" @@ -29,16 +30,14 @@ jobs: - name: Test SSH connection run: | - ip=$(docker inspect ssh-server-test | jq -r '.[0].NetworkSettings.IPAddress') - echo "TESTING IP $ip" - output=$(ssh -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$ip "echo test") + output=$(docker run --rm --network test-net alpine sh -c "apk add --no-cache openssh-client >/dev/null 2>&1 && ssh -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 root@ssh-server-test 'echo test'") if [ "$output" = "test" ]; then echo "SSH connection test passed" else echo "SSH connection test failed" exit 1 fi - docker stop ssh-server-test && docker rm ssh-server-test + docker stop ssh-server-test && docker rm ssh-server-test && docker network rm test-net build-and-push: runs-on: ubuntu-latest