diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9414382 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index feaed28..cbaca9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,4 +84,41 @@ jobs: - uses: actions-rs/cargo@v1 with: command: clippy - args: -- -D warnings \ No newline at end of file + args: -- -D warnings + + docker: + name: Build Docker image + runs-on: ubuntu-latest + concurrency: + group: docker + cancel-in-progress: true + if: success() + steps: + - uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to ghcr.io + uses: docker/login-action@v2 + if: github.ref == 'refs/heads/master' + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile + push: ${{ github.ref == 'refs/heads/master' }} + tags: | + ghcr.io/flatpak/flat-manager:${{ github.sha }} + ghcr.io/flatpak/flat-manager:latest + labels: | + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.source=ssh://git@github.com:${{ github.repository }}.git + org.opencontainers.image.url=https://github.com/${{ github.repository }} + cache-from: type=gha + cache-to: type=gha,mode=max