diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml new file mode 100644 index 0000000..ae64448 --- /dev/null +++ b/.github/workflows/publish-docker.yml @@ -0,0 +1,56 @@ +name: Publish Docker image + +on: + workflow_dispatch: + pull_request: + push: + branches: [master] + tags: ["*"] + +permissions: + contents: read + packages: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + docker: + runs-on: ubuntu-24.04 + env: + REGISTRY: ghcr.io + IMAGE_NAME: ghcr.io/mavlink/mavlink2rest + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + type=sha,prefix=,format=long + type=ref,event=tag + type=raw,value=latest + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/README.md b/README.md index 32f64c7..d6912aa 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Deploy mavlink2rest](https://github.com/mavlink/mavlink2rest/actions/workflows/deploy.yml/badge.svg)](https://github.com/mavlink/mavlink2rest/actions/workflows/deploy.yml) [![Test](https://github.com/mavlink/mavlink2rest/actions/workflows/test.yml/badge.svg)](https://github.com/mavlink/mavlink2rest/actions/workflows/test.yml) +[![Docker image (GHCR): ghcr.io/mavlink/mavlink2rest](https://img.shields.io/badge/docker-ghcr.io%2Fmavlink%2Fmavlink2rest-2496ED?logo=docker&logoColor=white)](https://github.com/mavlink/mavlink2rest/pkgs/container/mavlink2rest) [![Cargo download](https://img.shields.io/crates/d/mavlink2rest)](https://crates.io/crates/mavlink2rest) [![Crate info](https://img.shields.io/crates/v/mavlink2rest.svg)](https://crates.io/crates/mavlink2rest) [![Documentation](https://docs.rs/mavlink2rest/badge.svg)](https://docs.rs/mavlink2rest) @@ -122,7 +123,7 @@ docker build --build-arg TARGET_ARCH=x86_64-unknown-linux-musl -t mavlink/mavlin } } ``` - > :sunglasses: This is really hand when creating messages. + > :sunglasses: This is really hand when creating messages. * ... and a **status** structure defined as: ```js "status": {