add workflow
Some checks failed
Build and Push Containers / build-and-push (push) Has been cancelled
Some checks failed
Build and Push Containers / build-and-push (push) Has been cancelled
This commit is contained in:
38
.gitea/workflows/build-and-push.yml
Normal file
38
.gitea/workflows/build-and-push.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
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
|
||||
Reference in New Issue
Block a user