summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/build.yml42
1 files changed, 42 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..75b136a
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,42 @@
+name: Build and Push Docker image
+
+on:
+ push:
+ branches:
+ - main
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ env:
+ IMAGE_NAME: ${{ github.repository }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+ with:
+ platforms: all
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Build and push with cache
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ push: true
+ tags: ${{ env.IMAGE_NAME }}:latest
+ platforms: linux/amd64,linux/arm64
+ cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:cache
+ cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:cache,mode=max