Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/test-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test Container

on: [push]

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build Docker image
run: docker build -t test-image .

- name: Run container
run: docker run -d -p 8080:80 --name test-container test-image

- name: Wait for container to start
run: |
echo "Waiting for container to start..."
sleep 10

- name: Test root endpoint
run: |
curl -f http://localhost:8080/
if [ $? -ne 0 ]; then
echo "Failed to get a 200 OK response from the root endpoint."
exit 1
fi

- name: Test docs endpoint
run: |
curl -f http://localhost:8080/docs
if [ $? -ne 0 ]; then
echo "Failed to get a 200 OK response from the /docs endpoint."
exit 1
fi

- name: Stop and remove container
if: always()
run: docker stop test-container && docker rm test-container