Some checks failed
Build and Push Containers / build-and-push (push) Has been cancelled
39 lines
1006 B
YAML
39 lines
1006 B
YAML
name: Build and Push Containers
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push each container
|
|
run: |
|
|
for dir in */; do
|
|
dir="${dir%/}"
|
|
if [ -f "$dir/Dockerfile" ]; then
|
|
echo "Building $dir..."
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
--tag ${{ secrets.DOCKERHUB_USERNAME }}/${dir}:latest \
|
|
--tag ${{ secrets.DOCKERHUB_USERNAME }}/${dir}:${{ github.sha }} \
|
|
--push \
|
|
"$dir"
|
|
fi
|
|
done
|