Files
todoizer/.gitea/workflows/build.yaml
T
krisf 82d610a3ec
Build and Validate / build-and-test (push) Failing after 19s
Update workflow to push Docker image to registry
2026-04-21 08:32:05 -04:00

49 lines
1.4 KiB
YAML

name: Build and Validate
on:
push:
branches:
- main
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Build Docker image
run: docker build -t todoizer-app:latest .
- name: Run container
run: |
docker run -d --name todoizer -p 4567:4567 todoizer-app:latest
# Wait for application to start
sleep 5
- name: Validate web application loads
run: |
HTTP_STATUS=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:4567/)
if [ "$HTTP_STATUS" -ne 200 ]; then
echo "Failed to load web application. HTTP status: $HTTP_STATUS"
docker logs todoizer
exit 1
else
echo "Web application loaded successfully. HTTP status: $HTTP_STATUS"
fi
- name: Cleanup Test Container
if: always()
run: |
docker stop todoizer || true
docker rm todoizer || true
- name: Login to Gitea Container Registry
if: success()
run: echo "${{ github.token }}" | docker login gitea.krisforbes.ca -u ${{ github.actor }} --password-stdin
- name: Push Docker image
if: success()
run: |
docker tag todoizer-app:latest gitea.krisforbes.ca/krisf/todoizer:latest
docker push gitea.krisforbes.ca/krisf/todoizer:latest