|
| 1 | +name: Create and publish a Docker image |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths-ignore: |
| 8 | + - '**.md' |
| 9 | + - 'CITATION.cff' |
| 10 | + - 'LICENSE' |
| 11 | + - '.gitignore' |
| 12 | + - 'docs/**' |
| 13 | + pull_request: |
| 14 | + branches: |
| 15 | + - main |
| 16 | + paths-ignore: |
| 17 | + - '**.md' |
| 18 | + - 'CITATION.cff' |
| 19 | + - 'LICENSE' |
| 20 | + - '.gitignore' |
| 21 | + - 'docs/**' |
| 22 | + workflow_dispatch: |
| 23 | + inputs: |
| 24 | + manual_revision_reference: |
| 25 | + required: false |
| 26 | + type: string |
| 27 | + manual_revision_test: |
| 28 | + required: false |
| 29 | + type: string |
| 30 | + |
| 31 | +env: |
| 32 | + REGISTRY: ghcr.io |
| 33 | + IMAGE_NAME: ${{ github.repository }} |
| 34 | + |
| 35 | +jobs: |
| 36 | + build-and-push-image: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + permissions: |
| 39 | + contents: read |
| 40 | + packages: write |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Checkout repository |
| 44 | + uses: actions/checkout@v3 |
| 45 | + |
| 46 | + - name: Set up QEMU |
| 47 | + uses: docker/setup-qemu-action@v2 |
| 48 | + |
| 49 | + - name: Set up Docker Buildx |
| 50 | + uses: docker/setup-buildx-action@v2 |
| 51 | + with: |
| 52 | + platforms: linux/amd64,linux/arm64 |
| 53 | + |
| 54 | + - name: Log in to the Container registry |
| 55 | + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 |
| 56 | + with: |
| 57 | + registry: ${{ env.REGISTRY }} |
| 58 | + username: ${{ github.actor }} |
| 59 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + |
| 61 | + - name: Extract metadata (tags, labels) for Docker |
| 62 | + id: meta |
| 63 | + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 |
| 64 | + with: |
| 65 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 66 | + |
| 67 | + - name: Build & push training Docker image |
| 68 | + id: build-and-push-training |
| 69 | + uses: docker/build-push-action@v4 |
| 70 | + with: |
| 71 | + context: . |
| 72 | + push: true |
| 73 | + tags: ${{ steps.meta.outputs.tags }} |
| 74 | + labels: ${{ steps.meta.outputs.labels }} |
| 75 | + file: Dockerfile.training |
| 76 | + platforms: linux/amd64,linux/arm64 |
| 77 | + |
| 78 | + - name: Build and push test Docker image |
| 79 | + id: build-and-push-test |
| 80 | + uses: docker/build-push-action@v4 |
| 81 | + with: |
| 82 | + context: . |
| 83 | + push: true |
| 84 | + tags: ${{ steps.meta.outputs.tags }}-test |
| 85 | + labels: ${{ steps.meta.outputs.labels }} |
| 86 | + file: Dockerfile.test |
| 87 | + platforms: linux/amd64,linux/arm64 |
0 commit comments