Skip to content

stubs

stubs #260

Workflow file for this run

name: api
on:
push:
branches: [ "main" ]
paths:
- 'api/**/*.py'
- 'api/**/*.sh'
- 'api/**/Dockerfile'
- 'api/**/requirements.txt'
- 'api/**/.dockerignore'
- '**/api.yml'
pull_request:
branches: [ "main" ]
paths:
- 'api/**/*.py'
- 'api/**/*.sh'
- 'api/**/Dockerfile'
- 'api/**/requirements.txt'
- 'api/**/.dockerignore'
- '**/api.yml'
env:
COMPONENT: api
jobs:
build-and-push:
name: Build and push images
runs-on: ubuntu-latest
# Cancel in-progress jobs if matching component and platform when new PR arrives.
concurrency:
group: api
cancel-in-progress: true
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: main
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
# with:
# buildkitd-flags: --debug
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ env.COMPONENT }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Docker Hub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./${{ env.COMPONENT }}
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: linux/amd64, linux/arm64
# platforms: linux/amd64
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hamframe-${{ env.COMPONENT}}:latest
# https://docs.docker.com/build/ci/github-actions/cache/
- name: Temp fix
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache