Update README.md #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build_and_run_docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and run with Docker Compose | |
run: | | |
touch ./service/.env | |
docker-compose up --build -d | |
sleep 10 | |
- name: Check frontend accessible | |
run: | | |
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000) | |
if [[ "$response" == "200" ]]; then | |
echo "Application launched successfully" | |
else | |
echo "Application failed to launch" | |
exit 1 | |
fi | |
- name: Check backend accessible | |
run: | | |
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/health) | |
if [[ $response == "200" ]]; then | |
echo "Health check passed" | |
else | |
echo "Health check failed with status code $response" | |
exit 1 | |
fi | |
- name: Cleanup | |
if: always() | |
run: docker-compose down |