actions: build and push docker
Anirudh Oppiliappan x@icyphox.sh
Sun, 06 Oct 2024 17:29:41 +0300
1 files changed,
52 insertions(+),
0 deletions(-)
jump to
A
.github/workflows/docker.yaml
@@ -0,0 +1,52 @@
+name: build and push docker image + +on: + push: + branches: [master] + tags: ["*"] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Copy Dockerfile to . + run: cp ./contrib/Dockerfile ./Dockerfile + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: true + build-args: | + BUILDKIT_INLINE_CACHE=1