diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml new file mode 100644 index 000000000..84adc5558 --- /dev/null +++ b/.github/workflows/container.yml @@ -0,0 +1,69 @@ +name: Container + +on: + push: + paths-ignore: + - '.devcontainer/**' + - 'examples/**' + - 'lib/**' + - 'man/**' + - 'priv/**' + - '**.md' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + container: + name: Container + runs-on: ubuntu-20.04 + permissions: + packages: write + steps: + + - name: Check out repository code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Log in to the Container registry + uses: docker/login-action@v1.14.1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Get git describe + id: gitdescribe + run: echo "::set-output name=ver::$(git describe --tags)" + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3.8.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + labels: | + org.opencontainers.image.revision=${{ steps.gitdescribe.outputs.ver }} + org.opencontainers.image.licenses=GPL-2.0 + org.opencontainers.image.vendor=ProcessOne + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and push Docker image + uses: docker/build-push-action@v2.10.0 + with: + build-args: | + VERSION=${{ steps.gitdescribe.outputs.ver }} + cache-from: type=gha + cache-to: type=gha,mode=max + context: .github/container + labels: ${{ steps.meta.outputs.labels }} + #platforms: linux/amd64,linux/arm64 # arm takes 30 mins to compile + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }}