|
| 1 | +name: Docker inkeep/agents-manage-api |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-and-push: |
| 9 | + name: Build and Push Docker Image (inkeep/agents-manage-api) |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + # 1. Checkout source code |
| 14 | + - name: Checkout source code |
| 15 | + uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + fetch-depth: 0 # Fetches full history for better caching/context |
| 18 | + |
| 19 | + # 2. Set up Docker Buildx |
| 20 | + - name: Set up Docker Buildx |
| 21 | + uses: docker/setup-buildx-action@v3 |
| 22 | + |
| 23 | + # 3. Cache Docker layers |
| 24 | + - name: Cache Docker layers |
| 25 | + uses: actions/cache@v4 |
| 26 | + with: |
| 27 | + path: /tmp/.buildx-cache |
| 28 | + key: ${{ runner.os }}-buildx-${{ github.sha }} |
| 29 | + restore-keys: ${{ runner.os }}-buildx- |
| 30 | + |
| 31 | + # 4. Extract metadata |
| 32 | + - name: Extract metadata |
| 33 | + id: meta |
| 34 | + run: | |
| 35 | + echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> "$GITHUB_OUTPUT" |
| 36 | + echo "SHORT_SHA=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" |
| 37 | +
|
| 38 | + # 5. Login to Docker Hub |
| 39 | + - name: Log in to Docker Hub |
| 40 | + uses: docker/login-action@v3 |
| 41 | + with: |
| 42 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 43 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 44 | + |
| 45 | + # 6. Build and push image |
| 46 | + - name: Build and push production image |
| 47 | + uses: docker/build-push-action@v6 |
| 48 | + with: |
| 49 | + context: . |
| 50 | + file: Dockerfile.manage-api |
| 51 | + push: true |
| 52 | + platforms: linux/amd64,linux/arm64 |
| 53 | + tags: | |
| 54 | + inkeep/agents-manage-api:latest |
| 55 | + inkeep/agents-manage-api:${{ steps.meta.outputs.SHORT_SHA }} |
| 56 | + cache-from: type=gha |
| 57 | + cache-to: type=gha,mode=max |
0 commit comments