contentmonster/.forgejo/workflows/test.yml
Kumi efe8c1a37f
Some checks failed
Test! / test (push) Failing after 2m30s
fix: correct Docker build context for SSH server
The Docker build command for the SSH server container was incorrectly pointing to the Dockerfile instead of the directory containing it. This change corrects the build context to the correct directory, ensuring that all necessary files in `./ci-tests/` are included during the build process. This fix addresses issues with missing dependencies during the container build phase.
2024-04-22 17:01:42 +02:00

44 lines
1.2 KiB
YAML

name: Test!
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Generate SSH key pair
run: |
ssh-keygen -t rsa -b 4096 -f my_ssh_key -N ""
- name: Install Docker
run: |
apt-get update
apt-get install -y docker.io
- name: Build and run SSH Server Docker Container
run: |
docker build -t my-ssh-server ./ci-tests/
docker run -d -p 2222:22 --name ssh-server my-ssh-server
- name: Copy public key to Docker container
run: |
docker cp my_ssh_key.pub ssh-server:/home/replication/.ssh/authorized_keys
docker exec ssh-server chown replication:replication /home/replication/.ssh/authorized_keys
docker exec ssh-server chmod 600 /home/replication/.ssh/authorized_keys
- name: Trust SSH server's host key (to prevent interactive prompt)
run: |
ssh-keyscan -p 2222 -H localhost >> ~/.ssh/known_hosts
- name: Connect to SSH server using SSH key
run: |
ssh -i my_ssh_key -p 2222 root@localhost echo "SSH connection successful"