Skip to content

chore(infra): Add Docker Image CI workflow #3

chore(infra): Add Docker Image CI workflow

chore(infra): Add Docker Image CI workflow #3

Workflow file for this run

name: Docker Image CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Ensure .env exists from example
# If a .env is missing in the runner, copy example.env -> .env so docker-compose can read it
run: |
if [ -f .env ]; then
echo ".env already exists"
elif [ -f example.env ]; then
cp example.env .env
echo "Copied example.env -> .env"
else
echo "No example.env found; continuing without .env"
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and run services with Docker Compose
# This builds both frontend and backend (assuming docker-compose.yml defines both)
run: |
docker compose -f docker-compose.yml up -d --build
docker compose -f docker-compose.yml ps
- name: Wait for services to initialize
run: |
echo "Waiting for services to become ready (checking ps)..."
for i in {1..15}; do
docker compose -f docker-compose.yml ps
sleep 2
done
- name: Smoke test / show logs (customize endpoints as needed)
run: |
echo "=== Recent logs (tail 200) ==="
docker compose -f docker-compose.yml logs --no-color --tail=200 || true
# Example HTTP check (uncomment and adjust ports/endpoints for your app):
curl --fail http://localhost:8000/health || (docker compose -f docker-compose.yml logs && exit 1)