Add Docker build and test job to CI workflow
Added a new job to build and test the Docker image for the carbon-server.
This commit is contained in:
26
.github/workflows/ci.yml
vendored
26
.github/workflows/ci.yml
vendored
@@ -84,3 +84,29 @@ jobs:
|
|||||||
name: code-quality-reports
|
name: code-quality-reports
|
||||||
path: |
|
path: |
|
||||||
cppcheck-report.txt
|
cppcheck-report.txt
|
||||||
|
|
||||||
|
docker-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Build Docker image
|
||||||
|
run: |
|
||||||
|
docker build -t carbon-server:test .
|
||||||
|
- name: Test Docker container startup
|
||||||
|
run: |
|
||||||
|
# Start container in background
|
||||||
|
docker run -d --name carbon-test -p 8080:8080 carbon-server:test
|
||||||
|
# Wait for server to start
|
||||||
|
sleep 5
|
||||||
|
# Check if container is running
|
||||||
|
docker ps | grep carbon-test
|
||||||
|
# Test HTTP endpoint
|
||||||
|
curl -f http://localhost:8080/ || exit 1
|
||||||
|
# Check logs for errors
|
||||||
|
docker logs carbon-test
|
||||||
|
# Stop container
|
||||||
|
docker stop carbon-test
|
||||||
|
docker rm carbon-test
|
||||||
|
echo "✓ Docker container started and responded successfully"
|
||||||
|
|||||||
Reference in New Issue
Block a user