diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml new file mode 100644 index 0000000..400505d --- /dev/null +++ b/.github/workflows/docker_build.yml @@ -0,0 +1,47 @@ +name: Docker Build and Push + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: vvbbnn00/goflet + tags: | + type=sha,format=short + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: GITHUB_ACTIONS=true + platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7 + + - name: Image digest + run: echo ${{ steps.meta.outputs.digest }}