feature(docker): docker + CI Integrated #1
This file contains hidden or 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: CI | |
| # Reproducible builds gate: lint + tests on every push/PR, then a Docker image | |
| # build with a container smoke test. Week 3 (Docker Platform). | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint-test: | |
| name: Lint & test (CPU / mock) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| cache-dependency-path: requirements-dev.txt | |
| - name: Install dev dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-dev.txt | |
| - name: Lint (ruff) | |
| run: ruff check . | |
| - name: Test (pytest, mock backend) | |
| run: pytest -q | |
| docker-cpu: | |
| name: Build CPU image & smoke test | |
| runs-on: ubuntu-latest | |
| needs: lint-test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Mock-only image (INCLUDE_HF=0): no torch download, so CI stays fast. | |
| - name: Build CPU image | |
| run: | | |
| docker build -f deployment/docker/Dockerfile.cpu \ | |
| --build-arg INCLUDE_HF=0 -t atlasai:ci . | |
| - name: Run container | |
| run: docker run -d --name atlasai -p 8000:8000 atlasai:ci | |
| - name: Smoke test /health and /ready | |
| run: | | |
| for i in $(seq 1 30); do | |
| if curl -fsS http://localhost:8000/health >/dev/null; then | |
| echo "gateway up"; break | |
| fi | |
| sleep 2 | |
| done | |
| # /health must report ok; /ready must report the active mock backend | |
| # (the mock engine loads instantly, so readiness should be 200). | |
| curl -fsS http://localhost:8000/health | tee /dev/stderr | grep -q '"status":"ok"' | |
| curl -fsS http://localhost:8000/ready | tee /dev/stderr | grep -q '"backend":"mock"' | |
| - name: Container logs | |
| if: always() | |
| run: docker logs atlasai || true | |
| - name: Teardown | |
| if: always() | |
| run: docker rm -f atlasai || true |