|
9 | 9 |
|
10 | 10 | jobs:
|
11 | 11 | push_to_registry:
|
12 |
| - name: Build and Push to DockerHub Registry |
| 12 | + name: Build and Push Docker Image |
13 | 13 | runs-on: ubuntu-latest
|
14 |
| - |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + packages: write |
| 20 | + id-token: write |
15 | 21 | steps:
|
16 | 22 | - name: Checkout
|
17 |
| - uses: actions/checkout@v2 |
18 |
| - |
19 |
| - - name: Log in to Docker Hub |
20 |
| - uses: docker/login-action@v1 |
| 23 | + uses: actions/checkout@v4 |
21 | 24 | with:
|
22 |
| - username: ${{ secrets.DOCKER_USERNAME }} |
23 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
| 25 | + fetch-depth: 0 |
24 | 26 |
|
| 27 | + - name: Login to Github Packages |
| 28 | + uses: docker/login-action@v3 |
| 29 | + with: |
| 30 | + registry: ghcr.io |
| 31 | + username: ${{ github.actor }} |
| 32 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + |
| 34 | + - name: Extract Docker Metadata |
| 35 | + id: meta |
| 36 | + uses: docker/metadata-action@v5 |
| 37 | + with: |
| 38 | + flavor: | |
| 39 | + suffix=-${{ matrix.python-version }} |
| 40 | + tags: | |
| 41 | + type=ref,event=branch |
| 42 | + type=raw,value=${{ github.ref_name }} |
| 43 | + type=raw,value=latest,suffix=,enable=${{ github.ref_name == github.event.repository.default_branch }} |
| 44 | + images: | |
| 45 | + name=${{ secrets.DOCKER_USERNAME }}/python-base-eval-layer,enable=false |
| 46 | + name=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }} |
| 47 | + |
25 | 48 | - name: Build and Push Base Image
|
26 |
| - uses: docker/build-push-action@v2 |
| 49 | + uses: docker/build-push-action@v5 |
27 | 50 | with:
|
28 | 51 | push: true
|
29 |
| - tags: ${{ secrets.DOCKER_USERNAME }}/python-base-eval-layer |
| 52 | + tags: ${{ steps.meta.outputs.tags }} |
| 53 | + labels: ${{ steps.meta.outputs.labels }} |
30 | 54 | build-args: |
|
| 55 | + PYTHON_VERSION=${{ matrix.python-version }} |
31 | 56 | INVOKER_ID=${{ secrets.INVOKER_ID }}
|
32 | 57 | INVOKER_KEY=${{ secrets.INVOKER_KEY }}
|
33 | 58 | INVOKER_REGION=${{ secrets.INVOKER_REGION }}
|
| 59 | + |
| 60 | + # name: Build and Push to DockerHub Registry |
| 61 | + # runs-on: ubuntu-latest |
| 62 | + |
| 63 | + # steps: |
| 64 | + # - name: Checkout |
| 65 | + # uses: actions/checkout@v2 |
| 66 | + |
| 67 | + # - name: Log in to Docker Hub |
| 68 | + # uses: docker/login-action@v1 |
| 69 | + # with: |
| 70 | + # username: ${{ secrets.DOCKER_USERNAME }} |
| 71 | + # password: ${{ secrets.DOCKER_PASSWORD }} |
| 72 | + |
| 73 | + # - name: Build and Push Base Image |
| 74 | + # uses: docker/build-push-action@v2 |
| 75 | + # with: |
| 76 | + # push: true |
| 77 | + # tags: ${{ secrets.DOCKER_USERNAME }}/python-base-eval-layer |
| 78 | + # build-args: | |
| 79 | + # INVOKER_ID=${{ secrets.INVOKER_ID }} |
| 80 | + # INVOKER_KEY=${{ secrets.INVOKER_KEY }} |
| 81 | + # INVOKER_REGION=${{ secrets.INVOKER_REGION }} |
0 commit comments